/* V&J Tiendas — panel v2. Diseño de app móvil (modo «Operar»): tamaños de teléfono, barra inferior, cabecera oscura legible.
   Marca V&J: tinta y papel. Movimiento: entradas cortas con ease-out, solo transform/opacity, todo apagado con prefers-reduced-motion. */
:root {
	--bg: #f4f3ef; --card: #fff; --ink: #0a0a0a; --mute: #67646b; --line: #e6e3dc; --acc: #0a0a0a; --acc-ink: #fff;
	--warn: #8a5200; --warn-bg: #fff1d6; --bad: #b3261e; --ok: #1d6b3a;
	--ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); --r: 16px;
	--sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
	--tabbar: 64px;
	font: 400 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color-scheme: light;
	-webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; overflow-x: clip; overflow-wrap: anywhere; }
::selection { background: var(--ink); color: #fff; }
:focus-visible { outline: 2px solid #2f6fdf; outline-offset: 2px; }
[hidden] { display: none !important; }
/* «Sitio de escritorio» de Chrome Android: el script de la cabecera calcula --zf (ancho de diseño / ancho real de pantalla) */
html.zoomfix body { zoom: var(--zf); }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
h2 { font-size: 1.2rem; line-height: 1.25; margin-bottom: 1rem; text-wrap: balance; }
.muted { color: var(--mute); font-size: 0.92rem; }
small { display: block; color: var(--mute); font-size: 0.85rem; margin-top: 0.35rem; line-height: 1.4; }
code { background: #efede8; padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.85em; }

/* Entradas (un solo vocabulario: subir 12–14 px y aparecer) */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { opacity: 0; transform: translateY(28px); } }

/* Botones, controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 52px; padding: 0.7rem 1.4rem; border-radius: 999px; border: 1px solid var(--acc); background: var(--acc); color: var(--acc-ink); font-family: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; cursor: pointer; transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 200ms ease; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn--ghost { background: transparent; color: var(--ink); border-color: #cfcbc2; }
.icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; font-size: 1.5rem; line-height: 1; transition: transform 160ms var(--ease-out); }
.icon:active { transform: scale(0.92); }
.icon:disabled { opacity: 0.35; cursor: default; }
.icon svg { width: 20px; height: 20px; }
.link { background: none; border: 0; padding: 0.5rem 0; min-height: 48px; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.danger { color: var(--bad); }
input, select, textarea { width: 100%; min-height: 52px; padding: 0.7rem 0.9rem; border: 1px solid #d6d2c9; border-radius: 12px; background: #fff; font: inherit; color: var(--ink); caret-color: var(--ink); transition: border-color 200ms ease, box-shadow 200ms ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.12); }
textarea { resize: vertical; line-height: 1.45; }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 1rem; }
label > input, label > select, label > textarea { margin-top: 0.4rem; font-weight: 400; }

/* Cabecera: oscura, una línea, nunca desborda */
.top { position: sticky; top: 0; z-index: 20; background: #0a0a0a; color: #fff; padding-top: var(--sat); }
.top-in { display: flex; align-items: center; gap: 0.75rem; min-height: 60px; padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left)); max-width: 960px; margin: 0 auto; }
.shop { flex: 1; min-width: 0; font-family: inherit; font-weight: 700; font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-btn { flex: none; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0 0.95rem; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; color: #fff; text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: background-color 200ms ease, transform 160ms var(--ease-out); }
.top-btn:active { transform: scale(0.96); background: rgba(255, 255, 255, 0.12); }
.top-btn svg { width: 19px; height: 19px; }
.offline { margin: 0; padding: 0.65rem 1rem; background: var(--warn-bg); color: #5c3600; font-size: 0.92rem; text-align: center; }

/* Estructura */
main { max-width: 960px; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) calc(var(--tabbar) + var(--sab) + 6.5rem) max(1rem, env(safe-area-inset-left)); }
[role=tabpanel]:not([hidden]) { animation: rise 280ms var(--ease-out); }
.bar { margin-bottom: 0.9rem; }

/* Barra inferior (como una app): iconos grandes y nombre */
.tabbar { display: none; }
.in-app .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tabbar) + var(--sab)); padding-bottom: var(--sab); background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; border: 0; background: none; color: var(--mute); font-family: inherit; font-weight: 600; font-size: 0.78rem; line-height: 1; cursor: pointer; transition: color 200ms ease, transform 160ms var(--ease-out); }
.tabbar button:active { transform: scale(0.94); }
.tabbar svg { width: 26px; height: 26px; transition: transform 300ms var(--ease-out); }
.tabbar button[aria-selected="true"] { color: var(--ink); }
.tabbar button[aria-selected="true"] svg { transform: translateY(-1px) scale(1.06); }
.tabbar button[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink); animation: fade 250ms ease; }
.tabbar b { position: absolute; top: 7px; left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #b8142c; color: #fff; font-family: inherit; font-weight: 700; font-size: 0.72rem; line-height: 20px; text-align: center; }
.fab { display: none; }
.in-app .fab { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(var(--tabbar) + var(--sab) + 1rem); z-index: 25; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 56px; padding: 0 1.3rem 0 1.05rem; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-family: inherit; font-weight: 600; font-size: 1rem; line-height: 1; box-shadow: 0 10px 26px rgba(10, 10, 10, 0.32); cursor: pointer; animation: rise 400ms var(--ease-out) 250ms both; transition: transform 160ms var(--ease-out); }
.in-app .fab:active { transform: scale(0.96); }
.fab svg { width: 22px; height: 22px; }

/* Productos */
.list, .orders, .cats, .ph-list { list-style: none; }
.list { display: grid; gap: 0.7rem; }
.item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 0.9rem; align-items: center; width: 100%; padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform 160ms var(--ease-out), border-color 200ms ease; }
.item:active { transform: scale(0.985); }
.thumb { width: 72px; height: 90px; border-radius: 10px; background: #eceae4; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-t { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.item-t strong { font-size: 1.05rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-t .muted { font-size: 0.9rem; }
.item-s { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.price { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.tag { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; background: #eceae4; }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--mute); }
.list.enter > li, .orders.enter > li { animation: rise 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }

/* Tarjetas, ajustes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; margin-bottom: 1rem; }
.form { max-width: 560px; }
.form .btn, .account .btn { width: 100%; }
.acct-email { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.4rem; }
.acct-actions { display: grid; gap: 0.6rem; margin-top: 1rem; }
.cats li { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; }
.inline { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.inline .btn { flex: none; padding-inline: 1.1rem; }

/* Pedidos */
.chips { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; margin-bottom: 0.9rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; min-height: 46px; padding: 0 1.1rem; border-radius: 999px; border: 1px solid #d6d2c9; background: #fff; font-family: inherit; font-weight: 500; font-size: 0.95rem; line-height: 1.2; cursor: pointer; transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.orders { display: grid; gap: 0.7rem; }
.order p { margin: 0.45rem 0; }
.o-head { display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; align-items: baseline; }
.o-head strong { font-size: 1.1rem; }
.o-items { margin: 0.6rem 0; padding-left: 1.15rem; }
.o-items li { margin-bottom: 0.25rem; }
.o-foot { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; margin-top: 0.8rem; }
.o-foot select { width: auto; flex: 1; min-width: 160px; }
.o-foot .btn { width: 100%; }

/* Editor de producto: hoja a pantalla completa en el teléfono */
.editor { border: 0; padding: 0; width: min(100%, 640px); max-height: min(94svh, 900px); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28); background: #fff; color: var(--ink); }
.editor::backdrop { background: rgba(10, 10, 10, 0.5); }
.editor[open] { animation: sheet 340ms var(--ease-drawer); }
.editor[open]::backdrop { animation: fade 300ms ease; }
.editor form { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.ed-head, .ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); }
.ed-head { padding-top: calc(0.8rem + var(--sat)); }
.ed-head h2 { margin: 0; }
.ed-foot { border-bottom: 0; border-top: 1px solid var(--line); padding-bottom: calc(0.8rem + var(--sab)); }
.ed-foot .btn { min-width: 140px; }
.ed-body { overflow-y: auto; padding: 1.1rem; flex: 1; overscroll-behavior: contain; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.opt-preview p { margin: -0.4rem 0 0.9rem; font-size: 0.92rem; }
.chip { display: inline-block; margin: 0.15rem 0.25rem 0.15rem 0; padding: 0.2rem 0.65rem; border-radius: 999px; background: #efede8; }
.toggles { display: flex; flex-wrap: wrap; gap: 0.2rem 1.6rem; margin-bottom: 1rem; }
.switch { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 48px; margin: 0; font-weight: 400; cursor: pointer; }
.switch input { width: 24px; min-height: 0; height: 24px; accent-color: var(--ink); margin: 0; flex: none; }
.photos { border: 1px solid var(--line); border-radius: var(--r); padding: 0.9rem; margin: 0; min-width: 0; }
.photos legend { font-weight: 600; font-size: 0.95rem; padding: 0 0.3rem; }
.ph-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.8rem; margin-bottom: 0.9rem; }
.ph-list li { position: relative; display: grid; gap: 0.45rem; min-width: 0; }
.ph-list img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; background: #eceae4; display: block; }
.ph-list .main { position: absolute; top: 0.45rem; left: 0.45rem; background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; }
.ph-tools { display: flex; gap: 0.4rem; justify-content: center; }
.ph-list input { min-height: 44px; font-size: 0.9rem; }
.upload { cursor: pointer; width: 100%; }

/* Aviso */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--sab) + 5.2rem); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 0.85rem 1.2rem; border-radius: 999px; font-size: 0.95rem; transition: opacity 200ms ease, transform 300ms var(--ease-out); max-width: calc(100% - 2rem); width: max-content; text-align: center; z-index: 100; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
body:not(.in-app) .toast { bottom: 1.5rem; }

/* Acceso: la tarjeta sube y sus elementos entran en cascada */
.gate { min-height: var(--vh, 100svh); display: grid; place-items: center; padding: max(1.2rem, var(--sat)) 1.2rem max(1.2rem, var(--sab)); background: var(--bg); }
.gate-card { width: min(100%, 420px); background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 2rem 1.4rem 1.5rem; text-align: center; box-shadow: 0 20px 60px rgba(10, 10, 10, 0.08); animation: rise 480ms var(--ease-out); }
.gate-card > *, .gate-card form > * { animation: rise 460ms var(--ease-out) both; }
.gate-card > :nth-child(1) { animation-delay: 80ms; } .gate-card > :nth-child(2) { animation-delay: 140ms; } .gate-card > :nth-child(3) { animation-delay: 200ms; }
.gate-card form > :nth-child(1) { animation-delay: 220ms; } .gate-card form > :nth-child(2) { animation-delay: 270ms; } .gate-card form > :nth-child(3) { animation-delay: 320ms; }
.gate-card h1 { font-size: 1.65rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0.8rem 0 0.9rem; text-wrap: balance; }
.gate-card .btn { width: 100%; }
.gate-card label { text-align: left; }
.gate-logo { border-radius: 18px; }
.gate input.code { font-size: 2rem; letter-spacing: 0.45em; text-align: center; padding-left: 0.45em; font-variant-numeric: tabular-nums; }
.gate-links { display: flex; justify-content: space-between; gap: 1rem; margin: 0.4rem 0 0; }
.gate-err { color: var(--bad); min-height: 1.5em; margin: 0.6rem 0 0; font-size: 0.95rem; }
.gate-foot { margin: 0.4rem 0 0; }
.shops { list-style: none; margin: 1rem 0 0; display: grid; gap: 0.6rem; }
.shops .btn { width: 100%; }

/* Ayuda iPhone */
.ios-help { border: 0; border-radius: 20px; padding: 1.5rem; width: min(100% - 2rem, 440px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28); }
.ios-help::backdrop { background: rgba(10, 10, 10, 0.5); }
.ios-help[open] { animation: sheet 320ms var(--ease-drawer); }
.ios-help ol { padding-left: 1.2rem; }
.ios-help li { margin-bottom: 0.6rem; }
.ios-help .btn { width: 100%; margin-top: 0.6rem; }

/* Teléfono (por dispositivo, no por ancho): el editor ocupa toda la pantalla */
html.phone .editor { width: 100%; max-width: 100%; height: var(--vh, 100svh); max-height: var(--vh, 100svh); margin: 0; border-radius: 0; }
html.phone .row { grid-template-columns: 1fr; gap: 0; }
html.phone .top-btn span { display: none; }
html.phone .top-btn { width: 44px; padding: 0; justify-content: center; }
@media (max-width: 360px) { .ph-list { grid-template-columns: 1fr 1fr; } .item { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 0.7rem; } .thumb { width: 64px; height: 80px; } }

/* Escritorio: pestañas arriba, sin barra inferior (solo si no es un teléfono) */
@media (min-width: 900px) {
	html:not(.phone) body.in-app { display: grid; grid-template-rows: auto auto 1fr; }
	html:not(.phone) .in-app .tabbar { position: static; grid-row: 2; width: min(100%, 960px); margin: 0 auto; height: 52px; padding: 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0.5rem; }
	html:not(.phone) .tabbar button { flex-direction: row; gap: 0.5rem; padding: 0 1rem; font-size: 0.95rem; }
	html:not(.phone) .tabbar svg { width: 22px; height: 22px; }
	html:not(.phone) .tabbar button[aria-selected="true"]::before { top: auto; bottom: -1px; left: 0; right: 0; height: 3px; border-radius: 3px 3px 0 0; }
	html:not(.phone) .tabbar b { position: static; margin-left: 0.2rem; }
	html:not(.phone) main { grid-row: 3; width: 100%; padding-bottom: 6rem; }
	html:not(.phone) .in-app .fab { bottom: 1.5rem; }
	html:not(.phone) .toast { bottom: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* Tarjeta «Pantalla» */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.9rem 0 1rem; }
.seg button { min-height: 52px; border: 1px solid #d6d2c9; border-radius: 14px; background: #fff; color: var(--ink); font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, transform 160ms var(--ease-out); }
.seg button:active { transform: scale(0.97); }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.display .switch { margin-top: 0.4rem; }
.display .link { margin-top: 0.3rem; }
.diag { margin-top: 0.4rem; font-size: 0.8rem; word-break: break-word; }
@media (min-width: 640px) { html:not(.phone) .seg { grid-template-columns: repeat(4, 1fr); } }
/* «Reducir animaciones» elegido en la app: mismo efecto que el ajuste del sistema */
html.calm *, html.calm *::before, html.calm *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
