/* Catálogo ALPACE — pensado primero para el celular */
:root {
  --fondo: #f4f6f9; --superficie: #ffffff; --hundido: #eef2f7; --tinta: #14213d; --tinta-2: #4a5568; --tinta-3: #6b7585;
  --linea: #dde3eb; --marca: #1c5cab; --marca-2: #154a8c; --marca-suave: #e7eef8; --acento: #e8662e; --acento-tinta: #b84716;
  --bueno: #0f7a3a; --wa: #1fa855; --radio: 14px; --sombra: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0f1522; --superficie: #172033; --hundido: #1d2840; --tinta: #eef2f8; --tinta-2: #c3cddc; --tinta-3: #94a1b5;
    --linea: #2a3650; --marca: #6ea2ec; --marca-2: #8db6f1; --marca-suave: #1d2c48; --acento: #f08a57; --acento-tinta: #f5a37b;
    --bueno: #4fd18b; --wa: #2bc067; --sombra: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--tinta); font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.oculto { display: none !important; }

/* Barra superior */
.barra { position: sticky; top: 0; z-index: 20; background: var(--superficie); border-bottom: 1px solid var(--linea); }
.barra-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.barra img.logo { height: 34px; width: auto; }
@media (prefers-color-scheme: dark) { .barra img.logo { background: #fff; border-radius: 6px; padding: 3px 6px; } }
.quien { flex: 1; min-width: 0; }
.quien b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quien span { display: block; font-size: 13px; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-carrito { position: relative; display: flex; align-items: center; gap: 8px; border: 0; background: var(--marca); color: #fff; padding: 10px 14px; border-radius: 999px; font-weight: 600; }
.btn-carrito .n { background: #fff; color: var(--marca-2); border-radius: 999px; min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; padding: 0 6px; }
.btn-salir { border: 1px solid var(--linea); background: transparent; border-radius: 999px; padding: 8px 12px; color: var(--tinta-2); font-size: 14px; }

main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 120px; }
h2 { font-size: 19px; margin: 22px 0 10px; }
.sub { color: var(--tinta-3); font-size: 14px; margin: 0; }

/* Selector de cliente (vendedores) */
.elegir { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px; display: grid; gap: 8px; }
.elegir label { font-size: 13px; font-weight: 600; color: var(--tinta-2); }
.elegir input, .elegir select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--linea); background: var(--hundido); }

/* Buscador y filtros */
.herr { position: sticky; top: 55px; z-index: 10; background: var(--fondo); padding: 10px 0 8px; display: grid; gap: 8px; }
.buscar { width: 100%; padding: 12px 14px 12px 40px; border-radius: 12px; border: 1px solid var(--linea); background: var(--superficie) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7585' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M13 13l4 4'/%3E%3C/svg%3E") no-repeat 13px center; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--linea); background: var(--superficie); border-radius: 999px; padding: 7px 13px; font-size: 14px; color: var(--tinta-2); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--marca); border-color: var(--marca); color: #fff; }

/* Tarjetas de producto */
.rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .rejilla { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .rejilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.prod { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sombra); }
.prod .img { aspect-ratio: 1 / 1; background: var(--hundido); display: grid; place-items: center; border: 0; padding: 0; width: 100%; }
.prod .img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.sin-foto { width: 64px; height: 64px; border-radius: 50%; background: var(--marca-suave); color: var(--marca); display: grid; place-items: center; font-weight: 700; font-size: 22px; }
.prod .cuerpo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod .nombre { font-size: 15px; font-weight: 600; line-height: 1.25; }
.prod .meta { font-size: 12.5px; color: var(--tinta-3); }
.prod .precio { font-size: 19px; font-weight: 700; color: var(--tinta); margin-top: auto; padding-top: 6px; }
.prod .precio small { display: block; font-size: 12.5px; font-weight: 500; color: var(--tinta-3); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--acento-tinta); background: color-mix(in srgb, var(--acento) 14%, transparent); border-radius: 6px; padding: 2px 6px; }

/* Cantidad */
.cant { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.cant button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--linea); background: var(--hundido); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.cant input { width: 100%; min-width: 0; height: 38px; text-align: center; border-radius: 10px; border: 1px solid var(--linea); background: var(--superficie); font-weight: 600; }
.agregar { margin-top: 8px; width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--marca); background: transparent; color: var(--marca); font-weight: 600; }
.cant.activa input { border-color: var(--marca); }

/* Frecuentes */
.frec { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.frec .prod { flex: none; width: 168px; scroll-snap-align: start; }
.frec .prod .img { aspect-ratio: 4 / 3; }

/* Carrito */
.velo { position: fixed; inset: 0; background: rgba(10, 16, 30, .45); z-index: 40; }
.panel { position: fixed; z-index: 50; background: var(--superficie); display: flex; flex-direction: column; inset: auto 0 0 0; max-height: 88vh; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.18); }
@media (min-width: 760px) { .panel { inset: 0 0 0 auto; width: 420px; max-height: none; border-radius: 0; } }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--linea); }
.panel header h3 { margin: 0; font-size: 18px; }
.cerrar { border: 0; background: var(--hundido); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; }
.lineas { overflow-y: auto; padding: 8px 16px; flex: 1; }
.linea-c { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.linea-c .n { font-weight: 600; font-size: 15px; }
.linea-c .p { font-size: 13px; color: var(--tinta-3); }
.linea-c .s { text-align: right; font-weight: 600; }
.linea-c .cant { grid-column: 1 / -1; margin-top: 2px; }
.linea-c .cant input { max-width: 90px; }
.quitar { border: 0; background: transparent; color: var(--acento-tinta); font-size: 13px; padding: 0 0 0 8px; }
.pie-c { padding: 12px 16px 16px; border-top: 1px solid var(--linea); display: grid; gap: 10px; }
.pie-c textarea { width: 100%; border-radius: 10px; border: 1px solid var(--linea); background: var(--hundido); padding: 10px; resize: vertical; min-height: 44px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.total b { font-size: 21px; }
.enviar { height: 52px; border: 0; border-radius: 12px; background: var(--wa); color: #fff; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; }
.enviar:disabled { opacity: .5; }
.aviso { font-size: 13px; color: var(--tinta-3); }
.vacio { text-align: center; color: var(--tinta-3); padding: 40px 10px; }

/* Ficha de producto */
.ficha { inset: 0; margin: auto; width: min(560px, calc(100% - 24px)); height: fit-content; max-height: 90vh; border-radius: 18px; overflow-y: auto; }
.ficha .img-g { background: #fff; aspect-ratio: 1 / 1; display: grid; place-items: center; }
.ficha .img-g img { width: 100%; height: 100%; object-fit: contain; }
.ficha .det { padding: 16px; display: grid; gap: 8px; }
.ficha .det h3 { margin: 0; font-size: 20px; }

/* Barra fija del carrito en el celular */
.barra-pie { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--tinta); color: var(--fondo); border-radius: 16px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border: 0; width: auto; text-align: left; }
.barra-pie b { font-size: 17px; }
.estado { padding: 40px 0; text-align: center; color: var(--tinta-3); }
.error { color: var(--acento-tinta); }
:focus-visible { outline: 3px solid var(--marca); outline-offset: 2px; }
.cant .quitar { width: auto; height: auto; border: 0; background: transparent; font-size: 14px; padding: 0 0 0 6px; white-space: nowrap; }
.chips.sub-nivel .chip { padding: 5px 11px; font-size: 13px; background: var(--hundido); }
.chips.sub-nivel .chip[aria-pressed="true"] { background: var(--marca-suave); border-color: var(--marca); color: var(--marca-2); font-weight: 600; }
