/* ════════════════════════════════════════════════════════════════════════════
   components.css — los ladrillos de la app (§5.1), en la dirección Studio.
   Botones, campos, paneles, chips de estado, listas, tablas, tarjetas de resumen,
   el panel lateral / desde abajo, los toasts, los vacíos y los de carga.
   Regla: una pantalla nueva NO inventa CSS — compone estas clases.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap-lg);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 0.875rem;
  font-weight: var(--peso-fuerte);
  letter-spacing: -0.005em;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[aria-busy='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn .icono {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn--primario {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}
.btn--primario:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
}

.btn--secundario {
  background: var(--surface);
  border-color: var(--line-fuerte);
  color: var(--ink-900);
}
.btn--secundario:hover {
  background: var(--surface-2);
}

/* Cerrar la caja: la acción de fin de día, en tinta (aprobada en Studio). */
.btn--oscuro {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--surface);
}
.btn--oscuro:hover {
  background: var(--ink-700);
}

.btn--fantasma {
  background: transparent;
  color: var(--ink-700);
}
.btn--fantasma:hover {
  background: var(--surface-2);
  color: var(--ink-900);
}

/* Destructivo pero reversible (Cancelar turno, Dar de baja): texto ladrillo, sin relleno. */
.btn--cuidado {
  background: transparent;
  color: var(--danger-500);
}
.btn--cuidado:hover {
  background: var(--danger-50);
}

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

/* Link con peso de acción ("Ver atención →"): ciruela, sin caja. */
.btn--texto {
  min-height: var(--tap);
  padding: 0 var(--sp-2);
  background: transparent;
  color: var(--brand-600);
}
.btn--texto:hover {
  background: var(--brand-50);
}

/* Solo ícono (flechas, cerrar): cuadrado de 44px, con aria-label SIEMPRE. */
.btn--icono {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
}

/* Botón de un grupo de opciones (períodos de Reportes, tabs de Config, medio de pago).
   Se marca con `aria-pressed`, NO agregando .btn--primario a mano: el lector de
   pantalla anuncia "seleccionado", y el selector de atributo (0,2,0) le gana a
   .btn--secundario (0,1,0) en la cascada. (Un `btn--secundario btn--primario` se veía
   sin pintar: la cascada muerde.) */
.btn[aria-pressed='true'] {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.btn[aria-pressed='true']:hover {
  background: var(--brand-100);
}

.btn--ancho {
  width: 100%;
}
.btn--chico {
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  font-size: var(--txt-sm);
}

/* Guardando: el botón se apaga y gira. Sin esto, el dedo impaciente toca dos veces
   y se crean dos turnos. */
.btn[aria-busy='true'] .btn__texto {
  visibility: hidden;
}
.btn[aria-busy='true']::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--r-full);
  animation: girar 0.6s linear infinite;
}
@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

/* ── Campos ──────────────────────────────────────────────────────────────── */
.campo {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.campo__label {
  font-size: 0.875rem;
  font-weight: var(--peso-medio);
  color: var(--ink-900);
}
/* "(opcional)" al lado del rótulo: se lee, pero no compite con él */
.campo__opcional {
  color: var(--ink-500);
  font-weight: var(--peso-normal);
}
.campo__input,
.campo__select,
.campo__textarea {
  width: 100%;
  min-height: var(--tap-lg);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-fuerte);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--txt-input); /* 16px: menos que eso y iOS hace zoom al tocar el input */
  color: var(--ink-900);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.campo__textarea {
  min-height: 96px;
  resize: vertical;
}
.campo__input::placeholder,
.campo__textarea::placeholder {
  color: var(--ink-500);
  opacity: 0.8;
}
.campo__input:focus,
.campo__select:focus,
.campo__textarea:focus {
  border-color: var(--brand-500);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-100);
}
.campo__ayuda {
  font-size: var(--txt-sm);
  color: var(--ink-500);
  line-height: 1.5;
}

/* Buscador con lupa adentro (Clientes). */
.buscador {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.buscador > .icono {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-500);
  pointer-events: none;
}
.buscador .campo__input {
  padding-left: 42px;
}

/* ── Paneles: borde delicado, sin sombra ─────────────────────────────────── */
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sombra-1);
  overflow: hidden; /* las filas con hover respetan la esquina redonda */
}
.card__titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 60px;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line);
  font-weight: var(--peso-fuerte);
  font-size: var(--txt-base);
  color: var(--ink-900);
  letter-spacing: -0.012em;
}
.card__titulo h2,
.card__titulo h3 {
  font-size: var(--txt-base);
}
.card__titulo > .icono {
  color: var(--ink-500);
}
.card__cuerpo {
  padding: var(--sp-5);
}
.card__pie {
  padding: var(--sp-3) var(--sp-5) var(--sp-4);
  border-top: 1px solid var(--line);
}

/* ── Versalita / eyebrow: el rótulo técnico de toda la app ───────────────── */
.versalita {
  font-size: var(--txt-2xs);
  font-weight: var(--peso-fuerte);
  letter-spacing: var(--track-versalita);
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ── Chips de estado (§5.1) ──────────────────────────────────────────────────
   Siempre con TEXTO: el color acompaña, nunca es la única señal. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-700);
  font-size: var(--txt-xs);
  font-weight: var(--peso-fuerte);
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.chip::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
}
.chip--pendiente {
  background: var(--t-pendiente-bg);
  color: var(--t-pendiente-ink);
  box-shadow: inset 0 0 0 1px #f0dfb6;
}
.chip--confirmado {
  background: var(--t-confirmado-bg);
  color: var(--t-confirmado-ink);
  box-shadow: inset 0 0 0 1px #d6e1e8;
}
.chip--atendido {
  background: var(--t-atendido-bg);
  color: var(--t-atendido-ink);
  box-shadow: inset 0 0 0 1px #cfe0d8;
}
.chip--cobrado {
  background: #e2ebdc;
  color: var(--t-cobrado-ink);
}
.chip--no_show {
  background: var(--t-no_show-bg);
  color: var(--t-no_show-ink);
}
.chip--cancelado {
  background: var(--t-cancelado-bg);
  color: var(--t-cancelado-ink);
}
.chip--ok {
  background: var(--ok-50);
  color: var(--ok-500);
}
.chip--info {
  background: var(--info-50);
  color: var(--info-ink);
}

/* ── Listas (clientes, cobros, gastos, catálogo) ─────────────────────────── */
.lista {
  display: flex;
  flex-direction: column;
}
.lista__item {
  position: relative; /* para el link estirado de abajo */
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 60px;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.lista__item[role='button'] {
  cursor: pointer;
}
.lista__item[role='button']:focus-visible {
  outline-offset: -3px;
  box-shadow: none;
}
/* El ítem que lleva a algún lado: el <a> envuelve solo el nombre —así el foco se ve donde
   está el texto— pero su área táctil es TODA la fila. */
.lista__enlace {
  color: inherit;
  text-decoration: none;
}
.lista__enlace::after {
  content: '';
  position: absolute;
  inset: 0;
}
.lista__item:last-child {
  border-bottom: 0;
}
.lista__item:hover {
  background: #f8f8f2;
  text-decoration: none;
}
.lista__principal {
  flex: 1;
  min-width: 0;
}
.lista__titulo {
  font-weight: var(--peso-medio);
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lista__titulo .chip {
  margin-left: var(--sp-1);
}
.lista__sub {
  font-size: var(--txt-sm);
  font-weight: var(--peso-normal);
  color: var(--ink-500);
}
/* Los chips de estado van en su renglón: dentro del título, un nombre largo con "…" los tapaba. */
.lista__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}
.lista__sub--corta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lista__monto {
  flex: none;
  font-weight: var(--peso-fuerte);
  color: var(--ink-900);
  letter-spacing: -0.01em;
  text-align: right;
  white-space: nowrap;
}
.lista__monto--salida {
  color: var(--brand-700);
}
.lista__flecha {
  flex: none;
  color: var(--ink-300);
}

/* ── Tablas (Caja, Clientes en pantallas anchas) ─────────────────────────── */
.tabla {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--txt-sm);
}
.tabla th {
  padding: var(--sp-3) var(--sp-5);
  background: #f9f9f4;
  color: var(--ink-500);
  font-size: var(--txt-2xs);
  font-weight: var(--peso-fuerte);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tabla td {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line);
  color: var(--ink-700);
  vertical-align: middle;
}
.tabla tbody tr {
  position: relative; /* el link estirado de la primera celda cubre la fila */
}
.tabla tbody tr:hover {
  background: #f8f8f2;
}
.tabla td strong {
  color: var(--ink-900);
  font-weight: var(--peso-fuerte);
}
.tabla td small {
  display: block;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: var(--txt-xs);
}
/* El movimiento que se abre (el detalle de un cobro, 0013): un <button> con cara de texto en la
   primera celda, estirado sobre la fila como .lista__enlace — se toca en cualquier lado. */
.tabla__abrir {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tabla__abrir::after {
  content: '';
  position: absolute;
  inset: 0;
}
.tabla__abrir:focus-visible {
  outline-offset: 6px;
  box-shadow: none;
}
.tabla .tabla__num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Avatares ────────────────────────────────────────────────────────────── */
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--r-full);
  background: var(--tono-salvia-bg);
  color: var(--tono-salvia-ink);
  font-weight: var(--peso-fuerte);
  font-size: var(--txt-xs);
  letter-spacing: 0.02em;
}
.avatar--rosa {
  background: var(--tono-rosa-bg);
  color: var(--tono-rosa-ink);
}
.avatar--azul {
  background: var(--tono-azul-bg);
  color: var(--tono-azul-ink);
}
.avatar--lila {
  background: var(--tono-lila-bg);
  color: var(--tono-lila-ink);
}
.avatar--grande {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  font-size: var(--txt-lg);
}

/* ── Tarjetas de resumen (Caja, Gastos, Reportes) ────────────────────────────
   LA CORRECCIÓN APROBADA: bajas y compactas, importes de 22–26px, sin círculos ni
   negro. El tono va en el borde (salvia = entra plata, ciruela = sale); solo la
   DESTACADA se rellena. Un resultado negativo NUNCA se pinta como éxito. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--sp-3);
}
.tile {
  --tile-tono: var(--summary-sage);
  --tile-borde: var(--line);
  min-width: 0; /* un número largo se arregla adentro de su caja, no empuja la página */
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--tile-borde);
  border-radius: var(--r-tile);
}
.tile--salvia {
  --tile-tono: var(--summary-sage);
  --tile-borde: var(--summary-sage-line);
}
.tile--arcilla {
  --tile-tono: var(--summary-clay);
  --tile-borde: var(--summary-clay-line);
}
.tile--destacada {
  background: var(--tile-tono);
  border-color: var(--tile-tono);
  color: #fff;
}
.tile--destacada .tile__label,
.tile--destacada .tile__pie,
.tile--destacada .tile__valor {
  color: #fff;
}
/* Pérdida, faltante, esperado negativo: se dice con signo, texto y el tono de alerta. */
.tile--negativo {
  background: var(--danger-50);
  border-color: #e7b9ac;
}
.tile--negativo .tile__valor {
  color: var(--danger-ink);
}
.tile__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--txt-2xs);
  font-weight: var(--peso-fuerte);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.tile__valor {
  margin: 6px 0 2px;
  font-size: var(--txt-2xl);
  font-weight: var(--peso-medio);
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--ink-900);
  overflow-wrap: anywhere; /* siete dígitos en 360px: baja de línea antes que romper */
}
.tile__valor--ok {
  color: var(--ok-500);
}
.tile__valor--mal {
  color: var(--danger-500);
}
.tile__valor--nulo {
  color: var(--ink-500);
}
.tile__pie {
  font-size: var(--txt-xs);
  color: var(--ink-500);
  line-height: 1.45;
}

/* ── Nota (recuadro de apoyo) y alertas ──────────────────────────────────── */
.nota {
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--surface-2);
  color: var(--ink-700);
  font-size: var(--txt-sm);
  line-height: 1.6;
}
.nota--calida {
  background: var(--brand-50);
  border-color: var(--brand-100);
}
.nota--salvia {
  background: var(--ok-50);
  border-color: #d6e0d1;
}
.nota strong {
  color: var(--ink-900);
}

.alerta {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-tile);
  border: 1px solid transparent;
  border-left-width: 4px;
  font-size: var(--txt-sm);
  line-height: 1.55;
}
.alerta--error {
  background: var(--danger-50);
  border-color: #eec5b9;
  border-left-color: var(--danger-500);
  color: var(--danger-ink);
}
.alerta--info {
  background: var(--info-50);
  border-color: #d4e0e8;
  border-left-color: var(--info-500);
  color: var(--info-ink);
}
/* Salvia = salió bien (§5.1): el turno que ya se cobró, la caja que cuadró. */
.alerta--ok {
  background: var(--ok-50);
  border-color: #d3dfd0;
  border-left-color: var(--ok-500);
  color: #2c4535;
}

/* ── Detalle clave/valor (el turno, el cierre) ───────────────────────────── */
.detalle {
  margin: 0;
}
.detalle__linea {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--txt-sm);
}
.detalle__linea dt {
  color: var(--ink-500);
}
.detalle__linea dd {
  margin: 0;
  color: var(--ink-900);
  font-weight: var(--peso-fuerte);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* el precio por unidad debajo del renglón: "$ 18.000 c/u" */
.detalle__sub {
  display: block;
  color: var(--ink-500);
  font-size: var(--txt-xs);
}
/* Una acción al lado del dato ("Elegir" los servicios): conserva sus 44px tocables, pero los
   márgenes negativos no le estiran el renglón a la lista. */
.detalle__accion {
  margin-block: calc(-1 * var(--sp-3));
  margin-inline-start: var(--sp-1);
}

/* ── Opciones tocables (servicios del turno, medios de pago) ─────────────── */
.opciones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: var(--sp-2);
}
.opciones--medios {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* el tiempo a reservar de un turno sin servicio (0012): cinco botones cortos, una o dos filas */
.opciones--duracion {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 84px), 1fr));
}
.opciones--duracion .opcion {
  align-items: center;
}
.opcion {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-fuerte);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-900);
  font-size: var(--txt-sm);
  font-weight: var(--peso-medio);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.opcion:hover {
  background: var(--surface-2);
}
.opcion small {
  color: var(--ink-500);
  font-size: var(--txt-xs);
  font-weight: var(--peso-normal);
}
.opcion[aria-pressed='true'] {
  border-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-700);
  box-shadow: inset 0 0 0 1px var(--brand-500);
}
.opcion[aria-pressed='true'] small {
  color: var(--brand-700);
}

/* ── Segmentado (Día/Lista, Todos/Para reponer, tabs cortos) ─────────────── */
.segmentado {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.segmentado button {
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-700);
  font-size: var(--txt-sm);
  font-weight: var(--peso-medio);
  cursor: pointer;
}
.segmentado button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink-900);
  font-weight: var(--peso-fuerte);
  box-shadow: 0 1px 4px rgba(41, 44, 39, 0.08);
}

/* ── Total de un formulario (turno, venta, compra) ───────────────────────── */
.total-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-tile);
  background: var(--surface-2);
  font-size: var(--txt-sm);
}
.total-fila strong {
  font-size: 1.375rem;
  font-weight: var(--peso-medio);
  color: var(--ink-900);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.total-fila small {
  display: block;
  color: var(--ink-500);
  font-size: var(--txt-xs);
}

/* ── El panel (sheet): lateral en pantallas grandes, desde abajo en el celular ──
   Mismo componente para crear/ver turno, cobrar, vender, cerrar la caja y editar. */
.sheet-fondo {
  position: fixed;
  inset: 0;
  background: var(--fondo-modal);
  z-index: var(--z-sheet);
  animation: aparecer 0.15s ease-out;
}
@keyframes aparecer {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-2) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -8px 40px rgba(23, 29, 32, 0.18);
  z-index: calc(var(--z-sheet) + 1);
  animation: sheet-sube 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet:focus {
  outline: none;
}
@keyframes sheet-sube {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.sheet__agarre {
  width: 40px;
  height: 4px;
  margin: var(--sp-1) auto var(--sp-2);
  border-radius: var(--r-full);
  background: var(--line-fuerte);
}
/* La barra de arriba: de qué se trata (versalita) y la X. */
.sheet__barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: var(--tap);
  margin-bottom: var(--sp-3);
}
.sheet__barra > .versalita {
  min-width: 0;
  line-height: 1.4;
}
.sheet__cerrar {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin-right: calc(-1 * var(--sp-2));
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
}
.sheet__cerrar:hover {
  background: var(--surface-2);
  color: var(--ink-900);
}
.sheet__titulo,
.sheet h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: var(--peso-normal);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.sheet h3 {
  font-size: var(--txt-base);
}
.sheet__sub {
  margin-top: calc(-1 * var(--sp-2));
  color: var(--ink-500);
  font-size: var(--txt-sm);
}
/* La acción que cierra la tarea, fija al pie del panel mientras se scrollea (0012): el alta de
   turno en el celular obligaba a bajar hasta el fondo para guardar, aunque con cliente, día y
   hora ya alcanzara. Se come el padding de abajo del sheet para quedar pegada al borde. */
.sheet__pie {
  position: sticky;
  bottom: calc(-1 * (var(--sp-6) + env(safe-area-inset-bottom, 0px)));
  z-index: 1;
  margin: 0 calc(-1 * var(--sp-5)) calc(-1 * (var(--sp-6) + env(safe-area-inset-bottom, 0px)));
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.sheet__heroe {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.sheet__heroe > div {
  min-width: 0;
}
.sheet__acciones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}
.sheet__seccion {
  margin-top: var(--sp-2);
}
@media (min-width: 701px) {
  .sheet {
    top: 0;
    left: auto;
    right: 0;
    bottom: 0;
    width: min(var(--sheet-w), 100%);
    max-height: none;
    padding: var(--sp-5) var(--sp-6) var(--sp-6);
    border-radius: var(--r-xl) 0 0 var(--r-xl);
    box-shadow: var(--sombra-3);
    animation: sheet-entra 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .sheet__agarre {
    display: none;
  }
  .sheet__titulo,
  .sheet h2 {
    font-size: 2rem;
  }
  /* el panel lateral tiene más aire a los costados: el pie lo sigue hasta el borde */
  .sheet__pie {
    margin-inline: calc(-1 * var(--sp-6));
    padding-inline: var(--sp-6);
  }
}
@keyframes sheet-entra {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ── Toasts: qué pasó después de tocar el botón ──────────────────────────────
   En celular aparecen ARRIBA del bottom-nav (si no, el pulgar los tapa). */
.toasts {
  position: fixed;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(var(--bottomnav-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
}
@media (min-width: 701px) {
  .toasts {
    left: auto;
    right: var(--sp-5);
    bottom: var(--sp-5);
    width: 380px;
    align-items: stretch;
  }
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  max-width: 420px;
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border-radius: var(--r-tile);
  border-left: 4px solid #9fb392;
  background: var(--ink-900);
  color: #fbfbf4;
  font-size: var(--txt-sm);
  font-weight: var(--peso-medio);
  line-height: 1.45;
  box-shadow: var(--sombra-2);
  pointer-events: auto;
  animation: toast-entra 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.toast--error {
  border-left-color: #e29a86;
}
.toast__cerrar {
  display: grid;
  place-items: center;
  flex: none;
  min-width: var(--tap);
  min-height: var(--tap);
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
}
.toast__cerrar:hover {
  opacity: 1;
}
@keyframes toast-entra {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Estado vacío: una pantalla sin datos tiene que DECIR algo ───────────────
   Nunca un "no hay datos" pelado: qué falta, por qué, y el botón que lo arregla. */
.vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
}
.vacio__icono {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--sp-1);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--ink-500);
}
.vacio__titulo {
  font-family: var(--font-display);
  font-size: 1.375rem;
  color: var(--ink-900);
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.vacio__texto {
  max-width: 40ch;
  font-size: var(--txt-sm);
  color: var(--ink-500);
}
.vacio .btn {
  margin-top: var(--sp-3);
}

/* ── Carga: el hueso de la pantalla mientras llegan los datos ─────────────── */
.hueso {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: hueso-brilla 1.2s ease-in-out infinite;
}
@keyframes hueso-brilla {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.hueso--linea {
  height: 12px;
  margin: var(--sp-2) 0;
}
.hueso--titulo {
  height: 18px;
  width: 40%;
}

/* ── Varios ──────────────────────────────────────────────────────────────── */
.pila {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.pila--alta {
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.fila {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.fila--entre {
  justify-content: space-between;
}
.fila--envuelve {
  flex-wrap: wrap;
}

/* Dos datos cortos que se leen juntos (monto/fecha, fecha/medio) comparten fila incluso en
   celular. `minmax(0, 1fr)` evita que el input date empuje el panel más allá de la pantalla. */
.campos-en-linea {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

/* Un renglón de compra: la descripción respira a lo ancho y abajo quedan cantidad, precio y
   quitar. Los cuatro controles conservan targets táctiles de 44px sin forzar scroll horizontal. */
.compra-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) var(--tap);
  gap: var(--sp-2);
  align-items: end;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--surface-2);
}
.compra-item__descripcion {
  grid-column: 1 / -1;
}
/* El item que APUNTA a un producto: el nombre lo eligió el catálogo, no se edita. */
.compra-item__producto {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--peso-fuerte);
  color: var(--ink-900);
}
.compra-item__quitar {
  min-width: var(--tap);
  padding: 0;
  color: var(--danger-500);
}

/* Un renglón de la venta de mostrador. Acá el nombre NO es un campo —lo eligió el
   catálogo— y la cantidad se toca con − y +: un stepper es un tap, un input es un teclado. */
.venta-linea {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) var(--tap);
  gap: var(--sp-2);
  align-items: end;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--surface-2);
}
.venta-linea__nombre {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  font-weight: var(--peso-fuerte);
  color: var(--ink-900);
}
.venta-linea__cantidad {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.venta-linea__n {
  min-width: 2ch;
  text-align: center;
  font-weight: var(--peso-fuerte);
  font-variant-numeric: tabular-nums; /* que el ancho no baile al pasar de 9 a 10 */
}
.venta-linea__quitar {
  min-width: var(--tap);
  padding: 0;
  color: var(--danger-500);
}
/* Los huecos libres del profesional: pueden ser muchos → se envuelven y, si aun así no
   entran, el bloque scrollea solo (nunca empuja el panel a lo ancho). */
.fila--huecos {
  flex-wrap: wrap;
  max-height: 104px;
  overflow-y: auto;
  margin-top: var(--sp-2);
}

/* Los resultados de un buscador adentro del panel: lista corta con borde propio, para que
   se lea como un desplegable. */
.lista--sheet {
  max-height: 220px;
  overflow-y: auto;
  margin-top: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
}
.lista--sheet .lista__item {
  min-height: 56px;
  padding: var(--sp-2) var(--sp-3);
}
/* El catálogo del panel de venta: con las fotos cada opción ocupa más alto, y el punto es ver
   varias de un vistazo. */
.lista--catalogo {
  max-height: 300px;
}

/* ═══ La foto del producto (Fase 2, Etapa 6 — §10.2) ═══════════════════════════════════
   El mostrador se TOCA, no se lee. El cuadradito ocupa lugar SIEMPRE, con foto o sin ella:
   sin foto va la inicial, y las filas no bailan de ancho. */
.foto-prod {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  object-fit: cover;
  overflow: hidden;
}
.foto-prod--vacia {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  font-family: var(--font-display);
  font-size: var(--txt-lg);
  font-style: italic;
  text-transform: uppercase;
  user-select: none;
}
.foto-prod--grande {
  width: 96px;
  height: 96px;
  border-radius: var(--r-tile);
  font-size: 2.25rem;
}
.foto-campo {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.foto-campo__acciones {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.foto-campo__archivo {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Manual de uso (Ayuda) ───────────────────────────────────────────────── */
.ayuda-enlaces {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.ayuda-enlaces a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--ink-900);
  font-size: var(--txt-sm);
  font-weight: var(--peso-medio);
}
.ayuda-enlaces a:hover {
  border-color: var(--brand-200);
  background: var(--brand-50);
  text-decoration: none;
}
.ayuda-secciones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.ayuda-seccion {
  scroll-margin-top: var(--sp-4);
}
.ayuda-seccion .card__titulo {
  align-items: flex-start;
  flex-direction: column;
  gap: var(--sp-1);
  padding-top: var(--sp-5);
}
.ayuda-seccion .card__titulo > .icono {
  color: var(--brand-500);
}
.ayuda-seccion .card__titulo h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--peso-normal);
}
.ayuda-texto {
  display: grid;
  gap: var(--sp-3);
  line-height: 1.65;
  font-size: var(--txt-base);
}
.ayuda-texto h3 {
  margin-top: var(--sp-2);
  font-size: var(--txt-base);
}
.ayuda-texto ol,
.ayuda-texto ul {
  padding-left: var(--sp-5);
}
.ayuda-texto ol {
  list-style: decimal;
}
.ayuda-texto ul {
  list-style: disc;
}
.ayuda-texto li + li {
  margin-top: var(--sp-2);
}
.ayuda-preguntas {
  display: grid;
  gap: var(--sp-2);
}
.ayuda-preguntas details {
  border-top: 1px solid var(--line);
}
.ayuda-preguntas summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: var(--tap-lg);
  font-weight: var(--peso-fuerte);
  color: var(--ink-900);
  cursor: pointer;
  list-style: none;
}
.ayuda-preguntas summary::-webkit-details-marker {
  display: none;
}
.ayuda-preguntas summary::after {
  content: '+';
  color: var(--brand-600);
  font-size: var(--txt-xl);
  font-weight: var(--peso-normal);
}
.ayuda-preguntas details[open] summary::after {
  content: '−';
}
.ayuda-preguntas details p {
  padding-bottom: var(--sp-3);
  color: var(--ink-700);
}
