/* Usa los colores del tema de Telegram (variables --tg-theme-*), con valores de respaldo. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--hint) 20%, transparent);
}
.topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link { background: none; border: 0; color: var(--link); padding: 4px 0; white-space: nowrap; }

main { padding: 12px 16px; }
.pad { padding: 32px 0; }
.center { text-align: center; }
.muted { color: var(--hint); }

.search {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  border: 0; border-radius: 12px; background: var(--bg); color: var(--text); font-size: 15px;
}
.banner {
  background: var(--bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; color: var(--hint);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card {
  background: var(--bg); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer;
}
.card.soldout { opacity: .55; }
.thumb, .hero {
  background: var(--bg2) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.thumb { aspect-ratio: 1 / 1; }
.hero { aspect-ratio: 4 / 3; border-radius: var(--radius); margin-bottom: 14px; font-size: 56px; }
.thumb.loaded span, .hero.loaded span { display: none; }
.info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.info h3 { font-size: 14px; font-weight: 600; line-height: 1.25; }
.price { font-weight: 700; color: var(--accent); }
.price.big { font-size: 22px; margin: 4px 0 10px; }
.badge {
  align-self: flex-start; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg2); color: var(--hint);
}
.badge.in-cart { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge.danger { color: var(--danger); }
.badge.warn { background: color-mix(in srgb, #e08a00 16%, transparent); color: #b36b00; }
@media (prefers-color-scheme: dark) { .badge.warn { color: #f0b04a; } }
.badge.free { background: color-mix(in srgb, #2e9e5b 16%, transparent); color: #1f8a4c; }
@media (prefers-color-scheme: dark) { .badge.free { color: #5fd08a; } }

.panel { background: var(--bg); border-radius: var(--radius); padding: 16px; }
.desc { white-space: pre-wrap; margin: 0 0 16px; }

.primary, .secondary {
  width: 100%; padding: 13px; border-radius: 12px; border: 0; font-weight: 600; margin-top: 8px;
}
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: var(--bg2); color: var(--link); }

.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg2); border-radius: 10px; }
.stepper button { width: 34px; height: 34px; border: 0; background: none; font-size: 20px; color: var(--accent); }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; }

.lines { list-style: none; margin: 12px 0; padding: 0; }
.lines li {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--bg2);
}
.lines small { display: block; color: var(--hint); }
.lines .subtotal { grid-column: 2; text-align: right; font-weight: 600; }
.total { display: flex; justify-content: space-between; font-size: 17px; margin: 6px 0 16px; }

form { display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend, label > span { font-weight: 600; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
label { display: flex; flex-direction: column; }
.option { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border-radius: 10px; }
.option input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
select {
  width: 100%; padding: 10px 36px 10px 12px; border-radius: 10px; border: 0;
  background: var(--bg2); color: var(--text); font: inherit;
  /* Sin aspecto nativo: algunos visores (p. ej. Telegram Desktop) pintaban el desplegable blanco con el tema oscuro y el texto no se veía. */
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select:disabled { opacity: .6; }
select option { background: var(--bg); color: var(--text); }
.place { display: flex; flex-direction: column; gap: 14px; }
.pickup { background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.loc { display: flex; flex-direction: column; gap: 8px; }
.loc-ok { display: flex; justify-content: space-between; align-items: center; background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
input[type="tel"], input[type="url"], #checkout input[type="text"], textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 0;
  background: var(--bg2); color: var(--text); font: inherit; resize: vertical;
}
.transfer { background: var(--bg2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.transfer-box { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg2); border-radius: 10px; padding: 8px 8px 8px 12px; }
.copy-row > div { display: flex; flex-direction: column; min-width: 0; }
.copy-row small { color: var(--hint); font-size: 12px; }
.copy-row strong { font-family: ui-monospace, Menlo, monospace; font-size: 15px; overflow-wrap: anywhere; user-select: all; }
.copy-row button { width: auto; flex: none; margin: 0; padding: 9px 16px; background: var(--bg); }

.order { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.order header { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.order p { margin: 6px 0 0; color: var(--hint); font-size: 13px; }

.done { text-align: center; }
.done .big-emoji { font-size: 56px; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 100; /* por encima de las hojas (z-index 50) */
  background: var(--text); color: var(--bg); padding: 12px 14px; border-radius: 12px; text-align: center;
}

/* Fotos desde Supabase Storage */
.thumb, .hero { overflow: hidden; }
.thumb img, .hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.option > span { color: var(--text); font-weight: 400; font-size: 15px; margin: 0; }

/* Aviso de cambios en la configuración de la tienda y notas de pago */
.notice { background: color-mix(in srgb, var(--accent, #2481cc) 12%, transparent); border: 1px solid var(--accent, #2481cc); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; }
.pay-note { margin: 4px 0 12px; font-size: 14px; }

.hours-card { background: var(--bg); border-radius: 16px; overflow: hidden; margin: 0 0 12px; border: 1px solid transparent; }
.hours-card.is-closed { border-color: color-mix(in srgb, #f0a030 55%, transparent); }
.hours-head { width: 100%; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: none; border: 0; text-align: left; color: inherit; }
.hours-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.is-open .hours-icon { background: color-mix(in srgb, #2e9e6b 18%, transparent); color: #2e9e6b; }
.is-closed .hours-icon { background: color-mix(in srgb, #f0a030 20%, transparent); color: #c27a10; }
.hours-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.is-open .hours-text strong { color: #2e9e6b; }
.is-closed .hours-text strong { color: #c27a10; }
.hours-text small { color: var(--hint); font-size: 13px; }
.hours-chev { display: flex; color: var(--hint); transition: transform .2s; }
.hours-chev.up { transform: rotate(180deg); }
.hours-body { border-top: 1px solid var(--bg2); padding: 10px 14px 14px; }
.hours-body ul { list-style: none; margin: 0; padding: 0; }
.hours-body li { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--hint); }
.hours-body li.today { background: var(--bg2); color: var(--text); font-weight: 600; }
.hours-body .hrs { font-variant-numeric: tabular-nums; color: var(--text); }
.hours-body p { margin: 8px 0 0; font-size: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 2px 8px; }
.section-head h2 { font-size: 17px; }
.section-head span { font-size: 13px; }

/* Lupa y visor de foto a pantalla completa */
.hero { position: relative; }
.zoom-btn {
  position: absolute; right: 10px; bottom: 10px; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
#viewer {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.94);
  display: flex; align-items: center; justify-content: center; touch-action: pinch-zoom;
}
#viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Galería: carrusel con scroll-snap en la ficha y en el visor */
.gal-track, .viewer-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.gal-track::-webkit-scrollbar, .viewer-track::-webkit-scrollbar { display: none; }
.gal-slide, .viewer-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; }
.gal-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.gal-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 2px rgba(0,0,0,.4); }
.gal-dots span.on { background: #fff; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; }
.gal-nav.prev { left: 10px; } .gal-nav.next { right: 10px; }
.gal-nav .ic { margin: 0; }
@media (hover: hover) and (pointer: fine) { .gal-nav { display: flex; } }
.viewer-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 18px; cursor: pointer;
}

/* Categorías */
.seg { display: flex; background: color-mix(in srgb, var(--hint) 22%, transparent); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--hint); font-weight: 400; }
.seg button.on { background: var(--bg); color: var(--text); font-weight: 600; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chips button { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--bg); color: var(--text); white-space: nowrap; }
.cat-chips button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.cat-line { font-size: 12px; color: var(--hint); }
.cat-tile { display: flex; flex-direction: column; padding: 0; border: 0; text-align: left; background: var(--bg); border-radius: var(--radius); overflow: hidden; }
.mosaic { aspect-ratio: 1 / 1; width: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; background: var(--bg); }
.mc { background: var(--bg2); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.mc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ct-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 12px; }
.ct-info > div { display: flex; flex-direction: column; min-width: 0; }
.ct-info strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-info .muted { font-size: 12px; }
.ct-chev { color: var(--hint); font-size: 22px; }
.detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.detail-head h2 { flex: 1; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-head .muted { font-size: 13px; }
.back-btn { width: 44px; height: 44px; border: 0; background: none; color: var(--link); font-size: 28px; line-height: 1; margin-left: -10px; }

/* Iconos (Lucide, ver icons.js) */
.ic { vertical-align: -0.2em; flex: none; margin-right: .5em; }
.ic:last-child { margin-right: 0; }
.zoom-btn .ic, .viewer-close .ic, .seg .ic { margin: 0; }
.seg .ic { margin-right: .5em; vertical-align: -0.25em; }
.big-emoji .ic { margin: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.on { background: #2e9e5b; }
.dot.off { background: var(--danger); }

/* Interruptores (sustituyen a las casillas) */
.switch input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0 0 0 12px;
  width: 46px; height: 28px; border-radius: 14px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--hint) 45%, transparent); transition: background .15s;
}
.switch input[type="checkbox"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s;
}
.switch input[type="checkbox"]:checked { background: var(--accent); }
.switch input[type="checkbox"]:checked::before { transform: translateX(18px); }
.switch input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mis pedidos: envío a convenir y valoraciones */
.row-btns { display: flex; gap: 8px; margin-top: 10px; }
.row-btns > button { flex: 1; width: auto; }
.fee-box { margin-top: 4px; }
.small { font-size: 12px; }
.stars { display: inline-flex; gap: 2px; align-items: center; }
.star { color: var(--hint); display: inline-flex; }
.star.on { color: #f5a623; }
.star.on svg { fill: currentColor; }
.star-btn { background: none; border: 0; padding: 4px; cursor: pointer; }
.rev-done { margin-top: 8px; font-size: 13px; color: var(--hint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rev-open { margin-top: 10px; }
.order-complain { margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; color: var(--hint); font-size: 13px; }
.cancel-box { margin-top: 8px; }
.cancel-box .danger-btn { color: #d33; border-color: currentColor; width: 100%; }
.cancel-box p { margin: 4px 0 0; }
.order-hide { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--hint); font-size: 13px; }
.review { margin-top: 10px; }
.review .stars { margin-bottom: 8px; }
.review .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.review .chip { border: 1px solid color-mix(in srgb, var(--hint) 40%, transparent); background: none; color: var(--text); border-radius: 999px; padding: 5px 10px; font-size: 13px; }
.review .chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.review textarea { width: 100%; box-sizing: border-box; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--hint) 40%, transparent); background: var(--bg2); color: var(--text); padding: 8px 10px; font: inherit; resize: vertical; }

/* Acerca de */
.about-link { text-align: center; margin: 20px 0 4px; }
.about-link .link { font-size: 13px; color: var(--hint); }
.about h2 { font-size: 18px; margin-bottom: 8px; }
.about p { margin: 0 0 10px; }
.about a { color: var(--link); }
.consent { margin-top: 10px; }
.consent a { color: var(--link); }

/* Listas con scroll infinito: indicador al final */
.more { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 0 28px; color: var(--hint); font-size: 14px; }
.more .secondary { width: auto; }
.end-list { padding: 14px 0 24px; font-size: 13px; margin: 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--hint) 35%, transparent); border-top-color: var(--link, #2481cc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.grid > .tail-wrap { grid-column: 1 / -1; }

/* Mensajes con la tienda */
.top-actions { display: flex; gap: 6px; align-items: center; flex: none; }
/* Botones de icono de la barra superior: todos del mismo tamaño y color; el contador es un badge en la esquina. */
.tb-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--text); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tb-icon[hidden] { display: none; }
.tb-icon .ic { margin: 0; }
.tb-icon:hover { background: var(--bg2); }
.tb-icon.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tb-icon .badge-count { position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-text, #fff); font-size: 11px; font-weight: 700; text-align: center; box-sizing: border-box; border: 2px solid var(--bg); line-height: 14px; }
.tb-icon .badge-dot { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #e5484d); border: 2px solid var(--bg); box-sizing: border-box; }
/* Menú de la barra (Contactar, Mis pedidos…): se abre bajo el botón de los tres puntos. */
.tb-menu-wrap { position: relative; }
.tb-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 210px; padding: 6px; border-radius: 14px; background: var(--bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .22); border: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); }
.tb-menu[hidden], .tb-item[hidden] { display: none; }
.tb-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tb-item .ic { margin: 0; color: var(--hint); }
.tb-item:hover, .tb-item:focus-visible { background: var(--bg2); }
.tb-item .badge-dot { position: static; margin-left: auto; width: 10px; height: 10px; }
.tb-icon.spinning .ic { animation: spin .8s linear infinite; }
.tb-icon:disabled { opacity: .7; cursor: default; }
@media (prefers-reduced-motion: reduce) { .tb-icon.spinning .ic { animation-duration: 2.4s; } }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #e5484d); margin-left: 4px; vertical-align: middle; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.contact-box { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.contact-box p { margin: 0 0 8px; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; border-radius: 10px; padding: 10px 14px; font-size: 15px; }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; }
.msg .bubble { padding: 8px 12px; border-radius: 14px; line-height: 1.35; word-break: break-word; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-text, #fff); border-bottom-right-radius: 4px; }
.msg.theirs .bubble { background: var(--bg); color: var(--text); border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--hint); margin-top: 2px; }
.composer { position: sticky; bottom: 0; background: var(--bg2); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border, rgba(127,127,127,.2)); }
.composer textarea { width: 100%; resize: vertical; min-height: 44px; }
.chip-line { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.center-btn { display: block; margin: 0 auto 6px; }
.order-chat { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.contact-box .row-btns > * { flex: 1; }

#shop-name { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#shop-name:active { opacity: .6; }
.clear-cart{margin:6px 0 0;text-align:right}.clear-cart .link{font-size:13px;color:var(--hint)}

/* Favoritos y compartir */
.thumb { position: relative; }
.fav-btn {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.42); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fav-btn .ic { margin: 0; }
.fav-btn.on { background: rgba(255,255,255,.94); color: #e0245e; }
.fav-btn.on .ic { fill: currentColor; }
.hero-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; }
.hero-actions .fav-btn { position: static; width: 40px; height: 40px; }
.quick-add { margin-top: 6px; min-height: 36px; padding: 0 10px; font-size: 14px; }
.info .stepper { margin-top: 6px; }

#sheet {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  width: 100%; max-width: 520px; background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 17px; }
.sheet-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg2); color: var(--text); display: flex; align-items: center; justify-content: center; padding: 0; }
.sheet-close .ic { margin: 0; }
.sheet-sub { margin: 4px 0 0; font-size: 13px; }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.share-grid button {
  min-height: 52px; border: 0; border-radius: 12px; background: var(--bg2); color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; padding: 0 10px;
}
.share-grid button.wide { grid-column: 1 / -1; }
.share-grid .ic { margin: 0; }

/* Catálogo en el navegador (sin Telegram) */
#web-back { font-size: 22px; padding: 4px 6px 4px 0; display: inline-flex; align-items: center; }
#web-back[hidden], #tg-link[hidden] { display: none; }
#web-back .ic { margin: 0; }
.topbar #web-back + h1 { flex: 1; min-width: 0; }
#web-main {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(6px);
}
#web-main[hidden] { display: none; }
#web-main .primary { width: 100%; max-width: 560px; margin: 0 auto; display: block; }
#web-main .primary:disabled { opacity: .6; }
.has-main main { padding-bottom: 90px; }
.web-note { display: flex; gap: 8px; align-items: flex-start; }
.web-note .ic { flex: none; margin-top: 2px; }
.web-order { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.web-order .btn-link, .web-order button { width: 100%; box-sizing: border-box; }
.small-note { font-size: 12px; margin: 10px 0 0; }
/* Pedido web */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.track-box { margin: 14px 0 4px; }
.track-link { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bg2); background: var(--bg2); color: var(--text); font-size: 13px; }
.order .total { font-size: 14px; }
.section-head .link .ic { margin-right: 4px; }

/* Reportar un problema (tienda y Gestión) */
.br-intro { margin: 0 0 10px; font-size: 14px; }
.br-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.br-cats .chip { border: 1px solid color-mix(in srgb, var(--hint) 40%, transparent); background: none; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.br-cats .chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.br-msg { width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; font: inherit; color: var(--text); background: color-mix(in srgb, var(--hint) 8%, transparent); border: 1px solid color-mix(in srgb, var(--hint) 35%, transparent); border-radius: 10px; padding: 10px 12px; }
.br-count { font-size: 12px; margin: 4px 0 10px; text-align: right; }
.br-note { font-size: 12px; margin: 10px 0 0; }
.br .primary svg, .br-done svg { vertical-align: -4px; margin-right: 4px; }
.br-done { text-align: center; padding: 8px 0; }

/* Cómo pagar y comprobante de pago (Mis pedidos y pedido confirmado) */
.pay-box { margin: 10px 0; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent, #2481cc) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent, #2481cc) 35%, transparent); }
.pay-box h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 15px; }
.pay-box ol { margin: 0 0 8px; padding-left: 20px; font-size: 14px; }
.pay-box ol li { margin: 2px 0; }
.pay-box .transfer-box { margin: 8px 0; }
.pay-box .receipt-btn { width: 100%; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pay-box .receipt-ok, .receipt-ok { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; font-size: 14px; color: #1f8a3e; }
.receipt-ok .ic { flex: none; margin-top: 2px; }

/* Subcategorías: segunda fila de filtros, algo más discreta que la de categorías */
.cat-chips.sub-chips { margin-top: -4px; }
.cat-chips.sub-chips button { min-height: 34px; padding: 0 13px; font-size: 13px; background: transparent; border: 1px solid color-mix(in srgb, var(--hint) 40%, transparent); }
.cat-chips.sub-chips button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.captcha { margin: 10px 0; min-height: 65px; }
.captcha-ok { display: flex; align-items: center; gap: 6px; margin: 10px 0; font-size: 13px; }

/* ───────── Navegador de escritorio / pantallas anchas ─────────
   La tienda nació para el móvil. Todo lo de abajo va dentro de media queries: por debajo de 720 px
   (móvil, Mini App de Telegram en teléfono) no cambia nada. #app lleva data-view="<vista>" (ver render()). */

/* Teclado: anillo visible solo al navegar con Tab (no al tocar) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:focus-visible, .cat-tile:focus-visible { outline-offset: 0; }

/* Ratón: reacciones al pasar el cursor (los táctiles no tienen hover) */
@media (hover: hover) and (pointer: fine) {
  .card, .cat-tile { transition: transform .15s ease, box-shadow .15s ease; }
  .card:hover, .cat-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .12); }
  .card.soldout:hover { transform: none; box-shadow: none; }
  .link:hover { text-decoration: underline; }
  .cat-chips button:not(.on):hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
  .seg button:not(.on):hover { color: var(--text); }
  .primary:hover:not(:disabled) { filter: brightness(1.08); }
  .secondary:hover { filter: brightness(.95); }
  .fav-btn:hover, .zoom-btn:hover { filter: brightness(1.2); }
  .viewer-close:hover, .sheet-close:hover { filter: brightness(1.25); }
}

@media (min-width: 720px) {
  :root { --page: 1200px; --gutter: 24px; }

  /* Contenido centrado con ancho máximo; la cabecera se alinea con él */
  .topbar { padding-inline: max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter))); }
  .topbar h1 { font-size: 20px; }
  main { max-width: var(--page); margin-inline: auto; padding: 20px var(--gutter); }
  .has-main main { padding-bottom: 96px; }

  /* Pantallas de lectura/formulario: columna estrecha centrada, no 1200 px de ancho */
  #app:is([data-view="cart"], [data-view="done"], [data-view="about"], [data-view="report"], [data-view="error"]) { max-width: 720px; }
  #app:is([data-view="orders"], [data-view="weborders"], [data-view="chat"]) { max-width: 780px; }
  .panel { padding: 24px; }
  .order { padding: 16px 18px; }
  /* Carrito: nombre · cantidad · subtotal en una sola fila */
  #app[data-view="cart"] .lines li { grid-template-columns: 1fr auto 110px; gap: 6px 16px; }
  #app[data-view="cart"] .lines .subtotal { grid-column: 3; }
  .msg { max-width: 70%; }

  /* Controles del catálogo: no se estiran de lado a lado */
  .search { max-width: 520px; display: block; padding: 12px 16px; font-size: 16px; }
  .seg { max-width: 360px; }
  /* Chips: se parten en varias filas (con ratón el scroll horizontal es incómodo) */
  .cat-chips { flex-wrap: wrap; overflow: visible; margin: 0 0 12px; padding: 0; }

  /* Rejilla de productos y categorías */
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
  .info { padding: 12px 14px 14px; gap: 6px; }
  .info h3 { font-size: 15px; }
  .price { font-size: 16px; }
  .ct-info { padding: 12px 16px 16px; }

  /* Hoja (compartir) como diálogo centrado */
  #sheet { align-items: center; padding: 24px; }
  .sheet-card { max-width: 460px; border-radius: 18px; padding-bottom: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }

  /* Aviso emergente centrado y compacto */
  #toast { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: min(460px, calc(100% - 32px)); }

  /* Barra del carrito (solo navegador): botón flotante en vez de una barra de lado a lado */
  #web-main { background: none; backdrop-filter: none; pointer-events: none; }
  #web-main .primary { pointer-events: auto; max-width: 420px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
}

@media (min-width: 900px) {
  /* Producto: foto a la izquierda (fija al desplazar) y datos a la derecha */
  #app[data-view="product"] { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  #app[data-view="product"] > .hero { margin-bottom: 0; position: sticky; top: 84px; aspect-ratio: 1 / 1; }
  #app[data-view="product"] > .muted { grid-column: 1 / -1; }
  #app[data-view="product"] .panel h2 { font-size: 26px; line-height: 1.2; margin-bottom: 4px; }
  #app[data-view="product"] .price.big { font-size: 28px; }
  #app[data-view="product"] .desc { font-size: 16px; line-height: 1.55; }
  #app[data-view="product"] .panel .badge { margin: 0 6px 12px 0; }
}

@media (min-width: 1100px) {
  body { font-size: 16px; }
  .info h3 { font-size: 16px; }
}

@media (min-width: 1440px) {
  :root { --page: 1320px; }
}

/* Cintillo de avisos de la tienda */
.promo-strip { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 10px; padding: 9px 12px; margin: 0 0 12px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; text-align: left; }
.promo-strip svg { flex: none; }
.promo-strip.is-link { cursor: pointer; }
.promo-go { flex: none; font-size: 20px; line-height: 1; opacity: .85; }
.promo-view { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.promo-track { display: inline-flex; width: max-content; }
.promo-text { display: inline-block; padding-right: 48px; }
.promo-track:not(.run) .promo-text { padding-right: 0; }
.promo-track.run { animation: promo-scroll var(--promo-dur, 12s) linear infinite; }
@keyframes promo-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .promo-view { white-space: normal; overflow-wrap: anywhere; }
  .promo-track { width: auto; animation: none; }
}

/* Ofertas */
.price .was { color: var(--hint); font-weight: 400; font-size: .85em; margin-right: 4px; }
.badge.sale { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* Extras con precio: grupos de opciones en la ficha del producto */
.opt-group { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.opt-group { gap: 0; }
.opt-group legend { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 0; font-weight: 600; margin-bottom: 6px; }
.opt-group legend small { margin-left: auto; color: var(--hint); font-weight: 400; font-size: 13px; }
.opt-group .req { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.opt-row { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 11px 12px; margin-bottom: 6px; border-radius: 12px; background: var(--bg); cursor: pointer; }
.opt-row input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.opt-row .opt-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 400; color: var(--text); margin: 0; }
.opt-row .opt-price { color: var(--hint); font-weight: 600; white-space: nowrap; }
.panel > .primary[data-action="add-opts"] { margin-top: 14px; }
.opt-lines h3 { font-size: 15px; margin: 18px 0 6px; }
.lines small.opts { display: block; color: var(--text); opacity: .75; }

/* Varias monedas */
.tb-icon .badge-code { min-width: 0; height: 16px; padding: 0 3px; font-size: 9px; line-height: 12px; top: -2px; right: -4px; border-radius: 8px; }
.cur-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.cur-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cur-row small { display: block; margin-top: 2px; }
.cur-row.on { border-color: var(--accent); }
.equiv { margin: 2px 0 8px; text-align: right; font-size: .85em; }
.cur-edit { border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.cur-eq { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.cur-eq input { width: 6.5em; flex: 0 1 auto; }
.cur-eq select { width: auto; }

.tb-item .item-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--accent-text, #fff); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; box-sizing: border-box; }
.tb-item.on { color: var(--accent); }
.tb-item.on .ic { color: var(--accent); }
.total.pay-in { color: var(--accent); }
.pay-cur { border: 0; padding: 0; margin: 6px 0; }
.pay-cur legend { font-weight: 600; margin-bottom: 4px; }
.fee-row .fee-cur { width: auto; flex: 0 0 auto; }

/* Botón «cargando» (busy.js): texto atenuado y un borde de neón que gira alrededor del botón. */
@property --busy-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.is-busy {
  --busy-glow: color-mix(in srgb, var(--accent) 55%, #7fd4ff);
  position: relative; pointer-events: none; cursor: progress;
  -webkit-text-fill-color: color-mix(in srgb, currentColor 40%, transparent);
  animation: busy-pulse 1.4s ease-in-out infinite;
}
.is-busy > * { opacity: .55; }
.is-busy::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--busy-angle), transparent 0 55%, var(--busy-glow) 82%, #fff 98%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 4px var(--busy-glow));
  animation: busy-spin 1.1s linear infinite;
}
@keyframes busy-spin { to { --busy-angle: 360deg; } }
@keyframes busy-pulse { 50% { box-shadow: 0 0 10px -2px var(--busy-glow); } }
/* Mientras el usuario responde un diálogo, el borde espera. */
:root[data-busy-idle] .is-busy::after { visibility: hidden; }
:root[data-busy-idle] .is-busy { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .is-busy::after { animation: none; background: var(--busy-glow); }
}

