/* Tienda online. Las variables son las de Tesiss 5 (meta tenant.web.styles): cada empresa pone sus colores, fuente y
   radio de botón; su web.css va después y puede tocar cualquier cosa. La portada (main.landing) es de la empresa. */
:root {
    --color-bg: #fafaf8;
    --color-black: #17171a;
    --color-accent-bg: #17171a;
    --color-accent: #ffffff;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-button: 10px;
    --radius: 12px;
    --page: 1240px;
    --gutter: 24px;
    --muted: color-mix(in srgb, var(--color-black) 58%, var(--color-bg));
    --edge: color-mix(in srgb, var(--color-black) 22%, var(--color-bg));
    --line: color-mix(in srgb, var(--color-black) 11%, var(--color-bg));
    --soft: color-mix(in srgb, var(--color-black) 4%, var(--color-bg));
    --surface: color-mix(in srgb, var(--color-bg) 40%, #fff);
    --ring: 0 0 0 3px color-mix(in srgb, var(--color-black) 14%, transparent);
    --bad: #b42318;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
html:has(dialog[open]) { overflow: hidden; }
body { margin: 0; background: var(--color-bg); color: var(--color-black); font: 15px/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 24px; font-weight: 600; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 36px 0 14px; font-weight: 600; }
small { display: block; color: var(--muted); font-size: 13px; }
small:empty { display: none; }
s { color: var(--muted); font-weight: 400; }
.pre { white-space: pre-line; }
.muted { color: var(--muted); }
.right { text-align: right; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 64px 0; text-align: center; color: var(--muted); }
.empty .button { margin-top: 8px; }
.trap { position: absolute; left: -9999px; }   /* la trampa para bots (index.js): fuera de pantalla, no display:none */
.error { padding: 12px 16px; border-radius: var(--radius); background: #fdecec; color: var(--bad); margin: 0 0 24px; }

/* ---------- controles: etiqueta encima, campo de 46px, foco con halo; un campo mal rellenado se marca al salir de él ---------- */
input, textarea, button { font: inherit; color: inherit; }
label > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
label > span i { font-style: normal; font-weight: 400; color: var(--muted); }
input:not([type=radio], [type=checkbox]), textarea { width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--edge); border-radius: 10px;
    background: var(--surface); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:hover, textarea:hover { border-color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--color-black); box-shadow: var(--ring); }
input:user-invalid, textarea:user-invalid { border-color: var(--bad); }
input[type=radio] { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--color-black); }
button { padding: 11px 20px; border: 1px solid var(--edge); border-radius: var(--radius-button); background: var(--surface); cursor: pointer; font-weight: 500; }
button:hover { border-color: var(--muted); }
:focus-visible { outline: 2px solid var(--color-black); outline-offset: 2px; }
.button, button.primary { display: inline-block; min-height: 48px; padding: 13px 26px; border: 0; border-radius: var(--radius-button);
    background: var(--color-accent-bg); color: var(--color-accent); font-weight: 600; text-align: center; transition: filter .15s, transform .15s; }
.button:hover, button.primary:hover { filter: brightness(.92); }
.button:active, button.primary:active { transform: translateY(1px); }
button.ghost { background: none; }
button.x { padding: 4px 10px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; }
button.x:hover { color: var(--color-black); }
/* Dos columnas que pasan a una en el móvil; la dirección (y la contraseña al registrarse) ocupa la fila entera */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fields .wide { grid-column: 1 / -1; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
details { margin-top: 18px; }
summary { cursor: pointer; width: fit-content; font-weight: 500; margin-bottom: 14px; text-decoration: underline; text-underline-offset: 3px;
    text-decoration-color: var(--edge); }
summary:hover { text-decoration-color: currentColor; }

/* ---------- página: el contenido nunca pasa de --page; cabecera y pie, de lado a lado ---------- */
.bar, .page, footer { padding-inline: max(var(--gutter), (100% - var(--page)) / 2); }

/* ---------- cabecera: logo, categorías e iconos en una fila; fija ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--color-bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 24px; height: 68px; }
.top .bar { height: 56px; }
.brand { flex: none; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand img { display: block; height: 30px; width: auto; }
.me { display: flex; align-items: center; gap: 4px; margin-left: auto; margin-right: -8px; }
.ico { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 99px; cursor: pointer; }
.ico:hover { background: var(--soft); }
.ico svg { width: 22px; height: 22px; fill: currentColor; }
.search { margin: 0 0 24px; max-width: 480px; }
.search input { padding: 12px 16px 12px 40px; border-radius: 99px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M10.58 2a8.58 8.67 0 1 0 0 17.34 8.58 8.67 0 0 0 0-17.34ZM17.62 17.65a1 1 0 0 1 1.39 0l2.6 2.07a1.33 1.33 0 0 1-1.87 1.89l-2.2-2.52a1.07 1.07 0 0 1 .08-1.44Z'/%3E%3C/svg%3E") no-repeat 14px center; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; background: var(--color-accent-bg); color: var(--color-accent); font-weight: 600; }
.count { position: absolute; top: 2px; right: 0; display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--color-accent-bg); color: var(--color-accent); font-size: 11px; font-weight: 600; }
.count:empty { display: none; }
.cats { flex: 1; min-width: 0; display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; font-size: 12px; font-weight: 500;
    letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.cats::-webkit-scrollbar { display: none; }
.cats a { color: var(--muted); padding-block: 6px; }
.cats a:hover { color: var(--color-black); }
.cats a.on { color: var(--color-black); box-shadow: inset 0 -2px 0 currentColor; }

main.page { padding-block: 40px 96px; min-height: 60vh; }
main.narrow { --page: 820px; }   /* mis pedidos y un pedido: se leen mejor a media anchura */
footer { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer div { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
footer b { color: var(--color-black); }
footer a:hover { color: var(--color-black); }

/* Portada sin HTML propio */
.hello { min-height: 55vh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 48px 24px; }
.hello h1 { font-size: clamp(32px, 5vw, 56px); }

/* ---------- catálogo: tarjetas de ancho mínimo fijo; en cada una, las fotos, nombre con su + y precio, y las muestras ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 48px 20px; align-items: start; margin-bottom: 24px; }
/* El bloque de la variante marcada se disuelve (display: contents) para que fotos, textos y muestras repartan la tarjeta */
.card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.card > .v { display: none; }
.card > :checked + label + .v { display: contents; }
.card > label { order: 2; display: grid; place-items: center; min-width: 26px; height: 26px; margin-top: 6px; border: 1px solid var(--line);
    border-radius: 7px; background: var(--soft); overflow: hidden; cursor: pointer; font-size: 12px; transition: border-color .15s; }
.card > label:not(:has(img)) { padding-inline: 8px; background: none; }
.card > label:hover { border-color: var(--muted); }
.card > label img { width: 26px; height: 26px; object-fit: cover; }
.card > :checked + label { border-color: var(--color-black); box-shadow: 0 0 0 1px var(--color-black); }
.card > label:only-of-type { display: none; }
/* Fotos: la tarjeta lleva una sola, y tocarla abre el lightbox (que es quien usa la tira) */
.photo { position: relative; order: -1; flex: 0 0 100%; margin-bottom: 8px; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--soft); cursor: zoom-in; }
.strip { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip > * { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
/* La línea del artículo: SKU (y variante) y precio; − unidades + a la derecha. Nombre y descripción, en el lightbox.
   Si no caben juntos (tarjeta estrecha con − unidades + abierto), las unidades bajan a otra fila: nunca se montan */
.line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 12px; }
.info { flex: 1 1 90px; min-width: 0; overflow-wrap: anywhere; }
.line small { font-size: 12px; font-variant-numeric: tabular-nums; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.price b { font-weight: 600; font-size: 14px; }
.price s { font-size: 12px; }
.card .line { order: 1; flex: 0 0 100%; }
/* − unidades +: una cápsula; sin unidades de esa variante en el carrito (input sin valor), solo un + redondo */
.step { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--edge); border-radius: 99px; }
.step button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 99px; background: none; font-size: 18px; line-height: 1; }
.step button:hover { background: var(--soft); }
.step input { width: 30px; min-height: 0; padding: 0; border: 0; background: none; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.step input:focus { box-shadow: none; }
.step input::-webkit-inner-spin-button { display: none; }
.step:has(input:placeholder-shown) { border-color: transparent; }
.step:has(input:placeholder-shown) > :not(:last-child) { display: none; }
.step:has(input:placeholder-shown) button { background: var(--color-accent-bg); color: var(--color-accent); }
.step:has(input:placeholder-shown) button:hover { filter: brightness(.88); }
.pager { display: flex; justify-content: space-between; margin-top: 48px; font-weight: 500; }

/* Lightbox: otra tira, a pantalla completa; ‹ › a los lados, la cuenta arriba. La foto ocupa lo que deja el pie: no se tapan */
.lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(0 0 0 / .94); color: #fff; }
.lb[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lb::backdrop { background: none; }
.lb .strip { height: auto; min-height: 0; outline: none; }
.lb .strip > div { display: flex; align-items: center; justify-content: center; padding: 56px 72px 16px; }
.lb .strip img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; }
/* Pie del lightbox: el nombre y, debajo, la descripción del artículo; cuál de cuántas, arriba a la izquierda */
.cap { display: grid; justify-items: center; gap: 4px; padding: 0 24px 24px; text-align: center; font-size: 14px; }
.cap b { font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.cap span { position: fixed; top: 18px; left: 20px; opacity: .6; font-size: 13px; font-variant-numeric: tabular-nums; }
.cap p { max-width: 560px; max-height: 20vh; overflow-y: auto; margin: 0; opacity: .7; white-space: pre-line; }
.cap p:empty { display: none; }
.lb .x { position: absolute; top: 10px; right: 12px; color: #fff; font-size: 30px; }
.lb .x:hover { color: #fff; opacity: .7; }
.go { position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; font-size: 24px; font-weight: 300; line-height: 1;
    color: #fff; background: rgb(255 255 255 / .12); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: scale .15s, background .15s, opacity .15s; }
.go:hover:not(:disabled) { scale: 1.1; background: rgb(255 255 255 / .25); }
.go:disabled { opacity: .25; cursor: default; }
.go[data-go="-1"] { left: 16px; }
.go[data-go="1"] { right: 16px; }

/* ---------- carrito: líneas y pasos (datos, envío, pago) a la izquierda; el resumen se queda a la vista ---------- */
.checkout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; align-items: start; counter-reset: step; }
.checkout > div { display: grid; gap: 44px; }
.checkout legend { display: flex; align-items: center; gap: 10px; padding: 0; margin-bottom: 18px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.checkout legend::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
    background: var(--color-accent-bg); color: var(--color-accent); font-size: 13px; }
.items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.items li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 96px 32px; grid-template-areas: "thumb what step sum x";
    align-items: center; gap: 4px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.items .thumb { grid-area: thumb; width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--soft); }
.items .what { grid-area: what; }
.items .what b { font-weight: 500; }
.items .step { grid-area: step; }
.items .num { grid-area: sum; text-align: right; font-weight: 500; }
.items .x { grid-area: x; }
/* Envíos en mosaico; pagos en lista, y del marcado se ven sus instrucciones */
.opts { display: grid; gap: 10px; }
.opts.tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.opt { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--edge); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.opt:hover { border-color: var(--muted); }
.opt:has(:checked) { border-color: var(--color-black); box-shadow: 0 0 0 1px var(--color-black); }
.opt > span { flex: 1; min-width: 0; }
.opt b { font-weight: 600; }
.opt small { margin-top: 2px; }
.opt:not(:has(:checked)) .pre { display: none; }
.opt .pre { margin-top: 8px; color: var(--color-black); }
.checkout:has([data-pickup]:checked) .other { display: none; }
.summary { position: sticky; top: 88px; display: grid; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.summary h2 { margin: 0 0 4px; }
.summary p { display: flex; justify-content: space-between; gap: 16px; margin: 0; font-variant-numeric: tabular-nums; }
.summary p.muted { font-size: 13px; margin-top: -4px; }
.summary .total { font-size: 21px; font-weight: 700; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line); }
.summary button { width: 100%; margin-top: 8px; }
.done { max-width: 560px; margin: 48px auto; text-align: center; display: grid; gap: 8px; }
.done::before { content: "✓"; justify-self: center; display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 50%;
    background: var(--color-accent-bg); color: var(--color-accent); font-size: 26px; }
.done .pre { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: left; margin-top: 12px; }

/* ---------- cuenta y pedidos: cabecera (quién o qué pedido, y su estado) y debajo tarjetas ---------- */
.lines { width: 100%; border-collapse: collapse; }
.lines :is(td, th) { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.lines th { font-weight: 500; font-size: 13px; color: var(--muted); }
.lines .num { text-align: right; }
.lines .pic { width: 64px; }
.lines .thumb { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--soft); }
.two { display: grid; grid-template-columns: 1fr 1.6fr; gap: 28px; align-items: start; }
.box, .panel { padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.box { display: grid; gap: 16px; }
.box h2 { margin: 0; }
.box > button { justify-self: start; margin-top: 4px; }
.box:target { border-color: var(--color-black); }
main.page > .bar { height: auto; padding: 0; margin-bottom: 28px; justify-content: space-between; align-items: flex-start; }
main.page > .bar h1 { margin: 0 0 2px; }
.panel { margin-bottom: 16px; }
.panel h2 { margin: 0 0 8px; }
.panel .empty { padding: 40px 0 16px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); font-size: 14px; font-weight: 500; }
.back:hover { color: var(--color-black); }
.badge { font-style: normal; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.badge.draft { background: #fff4e0; color: #93590b; }
.badge.posted { background: #e6f4ea; color: #1e6b34; }
.orders { list-style: none; margin: 0 -12px; padding: 0; }
.orders a { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; align-items: center; gap: 16px; padding: 14px 12px; border-radius: 10px; }
.orders li + li a { box-shadow: 0 -1px 0 var(--line); }
.orders a:hover { background: var(--soft); box-shadow: none; }
.orders li:hover + li a { box-shadow: none; }
.orders .num { text-align: right; }
.orders .num::after { content: "›"; margin-left: 12px; color: var(--muted); }
.totals { display: grid; gap: 8px; width: min(100%, 280px); margin: 16px 0 0 auto; font-variant-numeric: tabular-nums; }
.totals p { display: flex; justify-content: space-between; margin: 0; }
.totals .muted { font-size: 13px; margin-top: -4px; }
.totals .total { font-size: 19px; font-weight: 700; padding-top: 10px; border-top: 1px solid var(--line); }
.notes { display: grid; gap: 10px; }
.notes p { margin: 0; color: var(--muted); }

@media (max-width: 1100px) {
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    :root { --gutter: 16px; }
    .checkout, .two { grid-template-columns: 1fr; gap: 40px; }
    .summary { position: static; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 12px; }
    .lb .strip > div { padding: 56px 0 16px; }
    .go { display: none; }
    /* En el móvil, la línea en dos filas: nombre y × arriba, unidades e importe debajo */
    .items li { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "thumb what x" "thumb step sum"; }
    .items .thumb { width: 56px; height: 56px; }
    .items .step { justify-self: start; }
    .box, .panel { padding: 20px 16px; }
    .orders a { grid-template-columns: minmax(0, 1fr) auto; }
    .orders .badge { grid-row: 2; justify-self: start; }
    .orders .num { grid-row: 1 / 3; grid-column: 2; }
}
@media (max-width: 520px) {
    .fields { grid-template-columns: 1fr; }
}
