:root {
  --azul: #12355b;
  --azul-claro: #e8eef5;
  --verde: #14894e;
  --verde-oscuro: #0f6e3e;
  --texto: #1c2430;
  --suave: #5d6b7a;
  --borde: #dde3ea;
  --fondo: #f4f6f9;
  --blanco: #fff;
  --rojo: #b42318;
  --radio: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
  padding-bottom: 96px;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Encabezado */
.encabezado {
  position: sticky; top: 0; z-index: 10;
  background: var(--azul); color: var(--blanco);
  padding: 10px 16px 0;
  padding-top: max(10px, env(safe-area-inset-top));
}
.encabezado__fila { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.encabezado__logo { height: 28px; width: auto; }
.encabezado__titulo { font-weight: 600; font-size: 15px; opacity: .9; }
.buscador { padding: 10px 0 8px; }
.buscador input {
  width: 100%; padding: 11px 14px; border: 0; border-radius: 10px;
  background: var(--blanco); color: var(--texto); font-size: 16px;
}
.marcas {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
.marcas::-webkit-scrollbar { display: none; }
.marcas button {
  flex: none; border: 1px solid rgba(255,255,255,.35); background: transparent; color: var(--blanco);
  border-radius: 999px; padding: 6px 13px; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.marcas button[aria-pressed="true"] { background: var(--blanco); color: var(--azul); border-color: var(--blanco); font-weight: 600; }

/* Lista */
main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
.aviso {
  background: var(--azul-claro); border-radius: var(--radio); padding: 10px 14px; font-size: 14px; margin-bottom: 8px;
}
.aviso span { display: block; color: var(--suave); }
.entrega-selector { margin-bottom: 10px; }
.entrega-selector__titulo { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--azul); }
.entrega-selector__opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.entrega-selector__opciones label { position: relative; cursor: pointer; }
.entrega-selector__opciones input { position: absolute; opacity: 0; pointer-events: none; }
.entrega-selector__opciones span {
  display: block; height: 100%; padding: 10px; border: 2px solid var(--borde); border-radius: var(--radio);
  background: var(--blanco); font-size: 14px; line-height: 1.3;
}
.entrega-selector__opciones small { display: block; margin-top: 2px; color: var(--suave); font-size: 12.5px; }
.entrega-selector__opciones input:checked + span { border-color: var(--azul); background: var(--azul-claro); }
.entrega-selector__opciones input:focus-visible + span { outline: 2px solid var(--azul); outline-offset: 2px; }
.aviso__volumen span { display: inline; color: inherit; font-weight: 700; }
.aviso__volumen { margin: 6px 0; padding: 8px 10px; background: #e3f4ea; border-radius: 8px; color: var(--verde-oscuro); }
.marca { scroll-margin-top: 150px; }
.marca__titulo { font-size: 20px; margin: 22px 0 2px; color: var(--azul); }
.seccion__titulo { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin: 4px 0 8px; font-weight: 600; }

.producto {
  display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center;
  background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 10px; margin-bottom: 8px;
}
.producto--elegido { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul) inset; }
.producto__foto {
  width: 84px; height: 84px; border: 0; padding: 0; border-radius: 8px; background: var(--fondo);
  overflow: hidden; cursor: zoom-in;
}
.producto__foto img { width: 100%; height: 100%; object-fit: contain; display: block; }
.producto__nombre { font-size: 14px; font-weight: 600; margin: 0; line-height: 1.25; }
.producto__sku { font-size: 12px; color: var(--suave); margin: 2px 0 6px; }
.producto__pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.producto__precio { font-weight: 700; }
.producto__precio small { font-weight: 400; color: var(--suave); }
.producto__precio s { font-weight: 400; color: var(--suave); font-size: 13px; }
.producto__precio .volumen { display: block; font-size: 12px; font-weight: 600; color: var(--verde); }

.cantidad { display: flex; align-items: center; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.cantidad button {
  width: 40px; height: 40px; border: 0; background: var(--fondo); font-size: 20px; cursor: pointer; color: var(--azul);
}
.cantidad button:active { background: var(--borde); }
.cantidad input {
  width: 52px; height: 40px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield;
}
.cantidad input::-webkit-outer-spin-button, .cantidad input::-webkit-inner-spin-button { -webkit-appearance: none; }

.vacio { text-align: center; color: var(--suave); padding: 40px 0; }

/* Barra inferior */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--blanco); border-top: 1px solid var(--borde);
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  flex-wrap: wrap;
}
.barra__nivel {
  flex-basis: 100%; margin: -4px 0 0; font-size: 13px; font-weight: 600; color: var(--azul);
  background: var(--azul-claro); border-radius: 8px; padding: 6px 10px; text-align: center;
}
.barra__nivel--ok { color: var(--verde-oscuro); background: #e3f4ea; }
.barra__info {
  display: flex; flex-direction: column; align-items: flex-start; font: inherit; font-size: 14px; color: var(--suave);
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
}
.barra__ver { color: var(--azul); font-weight: 700; white-space: nowrap; }

/* "Tu pedido" editable, sobre la barra de abajo */
.seleccion-fondo { position: fixed; inset: 0; z-index: 18; background: rgba(18,53,91,.35); }
/* Va dentro de la barra (arriba de todo), para que nunca quede tapado por ella en ningún celular. */
.seleccion {
  flex-basis: 100%; order: -1; margin: -12px -16px 0; min-width: 0;
  max-height: 55vh; display: flex; flex-direction: column;
  background: var(--blanco); border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--borde);
}
.barra:has(.seleccion:not([hidden])) { border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,.15); }
.seleccion__cabeza { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; border-bottom: 1px solid var(--borde); }
.seleccion__cabeza h2 { margin: 0; font-size: 17px; color: var(--azul); }
.seleccion__cabeza h2 span { font-size: 14px; font-weight: 400; color: var(--suave); }
.seleccion__cerrar { background: none; border: 0; font-size: 20px; color: var(--suave); padding: 4px 8px; cursor: pointer; }
.seleccion__lista { list-style: none; margin: 0; padding: 0 16px 8px; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.seleccion__item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--borde);
}
.seleccion__item:last-child { border-bottom: 0; }
.seleccion__texto { grid-column: 1 / -1; }
.seleccion__nombre { margin: 0; font-size: 14px; font-weight: 600; }
.seleccion__detalle { margin: 2px 0 0; font-size: 12.5px; color: var(--suave); }
.seleccion__importe { margin: 0; font-weight: 700; text-align: right; }
.seleccion__quitar { grid-column: 1 / -1; justify-self: start; background: none; border: 0; padding: 0; font-size: 13px; color: var(--rojo); cursor: pointer; }
.seleccion__item .cantidad { justify-self: start; width: max-content; }
.cantidad--chica button { width: 36px; height: 36px; }
.cantidad--chica input { width: 52px; height: 36px; }
.barra__info strong { font-size: 19px; color: var(--texto); }

.boton {
  display: inline-block; text-align: center; text-decoration: none;
  background: var(--verde); color: var(--blanco); border: 0; border-radius: 10px;
  padding: 12px 18px; font-weight: 600; cursor: pointer;
}
.boton:hover { background: var(--verde-oscuro); }
.boton:disabled { background: #b8c2cc; cursor: not-allowed; }
.boton--grande { width: 100%; padding: 15px; font-size: 17px; margin-top: 8px; }
.boton--secundario { background: var(--blanco); color: var(--azul); border: 2px solid var(--azul); }
.boton--secundario:hover { background: var(--azul-claro); }
.enlace--pdf { display: block; margin: 4px 0 8px; font-size: 15px; }
.enlace { background: none; border: 0; color: var(--azul); font-weight: 600; padding: 8px 0; cursor: pointer; }

/* Hojas (pedido / listo) */
.hoja { position: fixed; inset: 0; z-index: 30; background: var(--fondo); overflow-y: auto; }
.hoja__barra {
  position: sticky; top: 0; background: var(--blanco); border-bottom: 1px solid var(--borde);
  padding: 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); z-index: 1;
}
.hoja__contenido { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }
.hoja h1 { font-size: 22px; margin: 4px 0 12px; color: var(--azul); }
.hoja h2 { font-size: 17px; margin: 24px 0 8px; color: var(--azul); }

.resumen { list-style: none; margin: 0; padding: 0; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); }
.resumen li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--borde); font-size: 14px; }
.resumen li:last-child { border-bottom: 0; }
.resumen .detalle { color: var(--suave); font-size: 13px; }
.resumen .importe { font-weight: 600; text-align: right; }

.desglose { margin: 12px 0 0; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 14px; }
.desglose div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 15px; }
.desglose dt { color: var(--suave); }
.desglose dd { margin: 0; }
.desglose .total { border-top: 1px solid var(--borde); margin-top: 6px; padding-top: 8px; font-size: 18px; font-weight: 700; }
.desglose .total dt { color: var(--texto); }
.desglose .gratis { color: var(--verde); font-weight: 600; }

.nota { font-size: 13px; color: var(--suave); margin: 8px 0; }

form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
form input:not([type=checkbox]):not([type=radio]), form select {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 16px; font-weight: 400;
  border: 1px solid var(--borde); border-radius: 10px; background: var(--blanco);
}
/* Flecha propia en las listas para que quede centrada igual en todos los celulares. */
form select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235b6773' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
form input:focus, form select:focus { outline: 2px solid var(--azul); outline-offset: 0; border-color: var(--azul); }
form .invalido { border-color: var(--rojo) !important; }
.dos { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 600; margin-top: 8px; }
.check input { width: 20px; height: 20px; }
/* Misma forma que los demás campos: título arriba y opciones debajo. */
.pregunta { margin-bottom: 12px; }
.pregunta__titulo { display: block; font-size: 14px; font-weight: 600; }
.pregunta__opciones { display: flex; gap: 32px; margin-top: 4px; padding: 8px 0; }
.pregunta .check { margin: 0; font-weight: 400; }
.pregunta__opciones--columna { flex-direction: column; gap: 10px; }
.pregunta__opciones--columna .check { align-items: flex-start; }
.pregunta__opciones--columna .check input { margin-top: 1px; flex: none; }
.pregunta small { color: var(--suave); }
#bloque-entrega { margin-top: 16px; }
#info-tienda p { margin: 0 0 4px; }
.enlace--mapa { display: inline-block; padding: 4px 0 0; }
.pregunta.invalido .pregunta__titulo { color: var(--rojo); }
.pregunta.invalido input[type=radio] { outline: 2px solid var(--rojo); outline-offset: 1px; border-radius: 50%; }
.error { color: var(--rojo); background: #fdecea; border-radius: 10px; padding: 10px 12px; font-size: 14px; }

.listo { text-align: center; padding-top: 60px; }
.listo .enlace { display: block; margin: 20px auto 0; }
.listo__icono {
  width: 72px; height: 72px; border-radius: 50%; background: var(--verde); color: var(--blanco);
  font-size: 40px; line-height: 72px; margin: 0 auto 12px;
}

/* Visor de fotos */
.visor { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.visor::backdrop { background: rgba(0,0,0,.8); }
.visor img { max-width: min(92vw, 700px); max-height: 85vh; display: block; border-radius: 10px; background: var(--blanco); }
.visor__cerrar {
  position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--blanco); font-size: 20px; cursor: pointer;
}

@media (min-width: 700px) {
  .producto { grid-template-columns: 100px 1fr; }
  .producto__foto { width: 100px; height: 100px; }
}

/* Flujo de cliente */
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 14px; margin: 8px 0 12px; }
.saludo { margin: 0 0 6px; font-size: 16px; }
.direccion { margin: 4px 0; font-weight: 600; }
.ident-actual { font-size: 14px; color: var(--suave); margin: 16px 0 4px; }
.ident-actual strong { color: var(--texto); }
.aviso-nuevo .enlace { display: block; text-align: left; font-size: 14px; padding: 6px 0 0; }
.aviso-nuevo { background: #fff6e0; color: #7a5300; border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }

/* Cotización: hoja dentro de la página; al imprimir solo se imprime esta hoja */
.hoja--cotizacion { background: var(--blanco); z-index: 40; }
.cot__acciones { display: flex; justify-content: space-between; align-items: center; }
.cot { max-width: 820px; margin: 0 auto; padding: 16px; color: var(--texto); font-size: 13px; }
.cot__cabeza { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid var(--azul); padding-bottom: 12px; }
.cot__logo { background: var(--azul); border-radius: 8px; padding: 10px 14px; }
.cot__logo img { height: 40px; display: block; }
.cot__datos { text-align: right; }
.cot__datos h1 { margin: 0; font-size: 22px; color: var(--azul); }
.cot__datos p { margin: 2px 0; color: var(--suave); }
.cot__tabla { width: 100%; border-collapse: collapse; margin-top: 16px; }
.cot__tabla th { background: var(--azul); color: var(--blanco); text-align: left; padding: 8px 6px; font-size: 12px; }
.cot__tabla td { padding: 8px 6px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.cot small { color: var(--suave); }
.cot .n { text-align: right; white-space: nowrap; }
.cot__tabla { table-layout: auto; }
.cot__tabla td:nth-child(2) { overflow-wrap: anywhere; }
.cot__foto { width: 64px; }
.cot__foto img { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--borde); border-radius: 6px; }
.cot__totales { margin: 12px 0 0 auto; width: 280px; border-collapse: collapse; }
.cot__totales td { padding: 4px 8px; }
.cot__total td { font-size: 18px; font-weight: 700; border-top: 2px solid var(--azul); }
.cot__vigencia { margin-top: 20px; padding: 12px; background: var(--azul-claro); border-radius: 8px; }
.cot__pie { margin-top: 20px; color: var(--suave); font-size: 12px; }
@media (max-width: 480px) {
  .cot { padding: 10px 8px; font-size: 11px; }
  .cot__tabla th, .cot__tabla td { padding: 5px 3px; }
  .cot__tabla th { font-size: 10px; }
  .cot__foto, .cot__foto img { width: 44px; height: 44px; }
  .cot__datos h1 { font-size: 18px; }
}
@media print {
  body:has(#vista-cotizacion:not([hidden])) > *:not(#vista-cotizacion) { display: none !important; }
  body:has(#vista-cotizacion:not([hidden])) { padding: 0 !important; background: #fff; }
  #vista-cotizacion { position: static; overflow: visible; }
  .cot__acciones { display: none !important; }
  .cot__logo, .cot__tabla th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.cot__confirmar { margin-top: 16px; text-align: center; }
.cot__confirmar .boton { display: inline-block; padding: 12px 24px; font-size: 16px; }
@media print { .cot__confirmar .boton { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
