/* Tienda WEEM (/tienda/ y /admin/tienda). Usa los tokens --w-* de /shared/weem-ui.css, que ya
   resuelven claro y oscuro; acá solo se arma la composición de cada pantalla. */
/* El cuerpo lleva la misma familia que el resto del sitio: sin esto, el menú y el pie compartidos
   (que heredan la fuente) caían en la tipografía por defecto del navegador. */
body[data-content-template="kit-tienda"]:not(.tda-admin-body) { margin: 0; font-family: var(--w-font); color: var(--w-ink); }
.tda { color: var(--w-ink); font-family: var(--w-font); }
.tda [hidden] { display: none !important; }
.tda-wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.tda-narrow { width: min(640px, 100% - 32px); }
.tda-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(20px, 3vw, 32px); }
.tda-eyebrow { margin: 0 0 12px; font: 500 12px/1.4 var(--w-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--weem-sec-strong, var(--w-accent)); }
.tda-hero h1, .tda-product__title { margin: 0 0 14px; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.02em; text-wrap: balance; }
.tda-lead { margin: 0; max-width: 62ch; font-size: clamp(16px, 2vw, 19px); line-height: 1.6; color: var(--w-ink-2); }
.tda-section { padding: 0 0 clamp(48px, 8vw, 96px); }
.tda-section--top { padding-top: clamp(24px, 4vw, 40px); }
.tda-back { margin: 0 0 20px; }
.tda-back a, .tda-foot-note a { color: var(--weem-sec-strong, var(--w-accent)); }
.tda-foot-note { margin: 28px 0 0; color: var(--w-muted); font-size: 14px; }
.tda-hint { margin: 8px 0 0; color: var(--w-muted); font-size: 14px; line-height: 1.5; }
.tda-h2 { margin: 0 0 12px; font-size: 18px; }

.tda-status { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--w-radius); background: var(--w-surface-2); color: var(--w-ink-2); font-size: 14px; line-height: 1.5; }
.tda-status:empty, .tda-status[hidden] { display: none; }
.tda-status[data-tone="error"] { background: var(--w-danger-soft); color: var(--w-danger); }
.tda-status[data-tone="ok"] { background: var(--w-success-soft); color: var(--w-success); }
.tda-status--inline { margin: 8px 0 0; padding: 8px 10px; }

/* Catálogo */
.tda-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.tda-skeleton { height: 360px; border-radius: var(--w-radius-lg); }
.tda-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; color: inherit; text-decoration: none; }
.tda-card__body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; }
.tda-card__title { margin: 4px 0 0; font-size: 19px; line-height: 1.3; }
.tda-card__sub { margin: 0; color: var(--w-muted); font-size: 14px; line-height: 1.5; }
.tda-card__foot { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; }
.tda-card__cta { color: var(--weem-sec-strong, var(--w-accent)); font-size: 14px; font-weight: 600; white-space: nowrap; }
.tda-price { font: 600 18px/1.2 var(--w-font-mono); white-space: nowrap; }
.tda-cover { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--w-radius-lg) var(--w-radius-lg) 0 0;
  background: radial-gradient(120% 90% at 20% 10%, var(--w-accent-soft), transparent 60%), var(--w-surface-2); }
.tda-cover img { width: 100%; height: 100%; object-fit: cover; }
.tda-cover__kind { font: 600 14px/1 var(--w-font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--weem-sec-strong, var(--w-accent)); }

/* Producto */
.tda-product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); grid-template-areas: "media checkout" "info checkout"; gap: 28px 40px; align-items: start; }
.tda-product__media { grid-area: media; }
.tda-product__media .tda-cover { border-radius: var(--w-radius-lg); }
.tda-product__info { grid-area: info; }
.tda-product__info .w-chip { display: inline-flex; margin-bottom: 12px; }
.tda-description { margin-top: 20px; white-space: pre-line; line-height: 1.7; color: var(--w-ink-2); }
.tda-checkout { grid-area: checkout; position: sticky; top: 96px; }
.tda-checkout__title { margin: 0 0 12px; font-size: 20px; }
.tda-test { margin: 0 0 14px; padding: 8px 12px; border-radius: var(--w-radius); background: var(--w-warning-soft); color: var(--w-warning); font-size: 13px; font-weight: 600; }
.tda-summary { display: grid; gap: 8px; margin: 0 0 18px; }
.tda-summary > div { display: flex; justify-content: space-between; gap: 16px; }
.tda-summary dt { color: var(--w-muted); }
.tda-summary dd { margin: 0; text-align: right; font-family: var(--w-font-mono); overflow-wrap: anywhere; }
.tda-summary__total { padding-top: 10px; border-top: 1px solid var(--w-line); font-weight: 700; font-size: 18px; }
.tda-summary__total dt { color: var(--w-ink); }
.tda-form { display: grid; gap: 14px; min-width: 0; }
.tda-form .w-field, .tda-form__row > * { min-width: 0; }
.tda-form .w-input { width: 100%; max-width: 100%; box-sizing: border-box; }
.tda-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tda-coupon { display: flex; gap: 8px; }
.tda-coupon .w-input { flex: 1; min-width: 0; text-transform: uppercase; }
.tda-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; }
.tda-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--w-accent); }
.tda-check a { color: var(--weem-sec-strong, var(--w-accent)); }
.tda-secure { margin: 0; color: var(--w-muted); font-size: 12px; line-height: 1.5; text-align: center; }

/* Gracias, Mis compras, pasarela de prueba */
.tda-delivery { display: grid; justify-items: start; gap: 4px; margin: 4px 0 0; }
.tda-library { display: grid; gap: 14px; margin-top: 16px; }
.tda-purchase { display: grid; grid-template-columns: 120px 1fr; overflow: hidden; padding: 0; }
.tda-purchase .tda-cover { height: 100%; aspect-ratio: auto; min-height: 120px; border-radius: 0; }
.tda-purchase__body { display: grid; gap: 8px; padding: 16px; }
.tda-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.tda-library-form { margin-bottom: 16px; }

@media (max-width: 860px) {
  .tda-product { grid-template-columns: 1fr; grid-template-areas: "media" "info" "checkout"; }
  .tda-checkout { position: static; }
}
@media (max-width: 520px) {
  .tda-form__row { grid-template-columns: 1fr; }
  .tda-purchase { grid-template-columns: 1fr; }
  .tda-purchase .tda-cover { min-height: 140px; }
  .tda-actions .w-btn { flex: 1; }
}

/* ==========================================================================
   Páginas de pago y tienda pública (2026-11-12). Las reglas van bajo [data-tienda] (el <main> de
   las páginas públicas) o usan clases propias (tda-receipt, tda-mark, tda-steps, tda-pay…) que el
   panel /admin/tienda, que comparte esta hoja, no usa; la impresión también deja el panel igual.
   - /pagar: la columna de la izquierda explica; la tarjeta de la derecha es el comprobante.
   - /pagar/gracias y /tienda/gracias: columna centrada con la marca de estado y el comprobante.
   - data-tda-state (lo pone tienda-client.js) elige ícono, color, etiqueta y animación:
     cargando, pendiente, sin-pasarela, esperando, demorado, pagado, vencido, anulado, cancelado,
     fallido, reembolsado y error. Verde = listo, ámbar = espera, rojo = error; siempre con texto.
   - Sin la franja como tira grande: solo como marcador chico (etiqueta y barra de pasos).
   ========================================================================== */
[data-tienda] {
  --tda-accent: var(--weem-sec, var(--w-accent));
  --tda-accent-ink: var(--weem-sec-strong, var(--w-accent));
  --tda-tone: var(--w-muted);
  --tda-tone-soft: var(--w-surface-2);
  --tda-ease: cubic-bezier(.16, 1, .3, 1);
  --tda-ico-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --tda-ico-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
  --tda-ico-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E");
  --tda-ico-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5v5.5M12 16.4v.1'/%3E%3C/svg%3E");
  --tda-ico-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.6v.1'/%3E%3C/svg%3E");
  --tda-ico-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 8 5 12l4 4M5 12h10a4 4 0 0 1 0 8h-2'/%3E%3C/svg%3E");
  --tda-ico-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='10.5' width='15' height='10' rx='2.5'/%3E%3Cpath d='M8 10.5V7.5a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  --tda-badge-ico: var(--tda-ico-clock);
}
[data-tda-state="pagado"] { --tda-tone: var(--w-success); --tda-tone-soft: var(--w-success-soft); --tda-badge-ico: var(--tda-ico-check); }
:is([data-tda-state="pendiente"], [data-tda-state="esperando"], [data-tda-state="demorado"], [data-tda-state="vencido"]) { --tda-tone: var(--w-warning); --tda-tone-soft: var(--w-warning-soft); }
[data-tda-state="sin-pasarela"] { --tda-tone: var(--w-warning); --tda-tone-soft: var(--w-warning-soft); --tda-badge-ico: var(--tda-ico-alert); }
:is([data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="fallido"]) { --tda-tone: var(--w-danger); --tda-tone-soft: var(--w-danger-soft); --tda-badge-ico: var(--tda-ico-x); }
[data-tda-state="error"], [data-tda-state="bloqueado"] { --tda-tone: var(--w-danger); --tda-tone-soft: var(--w-danger-soft); --tda-badge-ico: var(--tda-ico-alert); }
[data-tda-state="reembolsado"] { --tda-badge-ico: var(--tda-ico-back); }

/* Etiqueta con la franja y titulares */
.tda-franja { display: inline-block; flex: none; width: 16px; height: 6px; margin-right: 10px; border-radius: 1.5px; background: var(--tda-accent, var(--w-accent)); transform: skewX(-21deg); }
[data-tienda] .tda-eyebrow { display: flex; align-items: center; color: var(--tda-accent-ink); font: 600 12px/1.4 var(--w-font-mono); letter-spacing: .14em; }
[data-tienda] h1 { letter-spacing: -.03em; overflow-wrap: anywhere; }
[data-tienda] .tda-hero h1 { font-size: clamp(32px, 5vw, 56px); line-height: 1.04; }
[data-tienda] .tda-lead { color: var(--w-ink-2); }
[data-tienda] .tda-ico { flex: none; }

/* Avisos de estado: tono + ícono + texto (nunca solo color) */
[data-tienda] .tda-status { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; padding: 12px 14px; border: 1px solid var(--w-line); border-radius: 12px; background: var(--w-surface); color: var(--w-ink-2); font-size: 14.5px; line-height: 1.5; text-align: left; }
[data-tienda] .tda-status::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: currentColor; -webkit-mask: var(--tda-ico-info) center / contain no-repeat; mask: var(--tda-ico-info) center / contain no-repeat; }
[data-tienda] .tda-status[data-tone="error"] { border-color: color-mix(in srgb, var(--w-danger) 28%, transparent); background: var(--w-danger-soft); color: color-mix(in srgb, var(--w-danger) 80%, var(--w-ink)); }
[data-tienda] .tda-status[data-tone="error"]::before { -webkit-mask-image: var(--tda-ico-alert); mask-image: var(--tda-ico-alert); }
[data-tienda] .tda-status[data-tone="ok"] { border-color: color-mix(in srgb, var(--w-success) 28%, transparent); background: var(--w-success-soft); color: color-mix(in srgb, var(--w-success) 80%, var(--w-ink)); }
/* Sin pasarela y «sin confirmar» son esperas, no fallas: el aviso toma el ámbar de la etiqueta. */
[data-tienda]:is([data-tda-state="sin-pasarela"], [data-tda-state="demorado"]) .tda-status[data-tone="error"] { border-color: color-mix(in srgb, var(--w-warning) 30%, transparent); background: var(--w-warning-soft); color: color-mix(in srgb, var(--w-warning) 85%, var(--w-ink)); }
[data-tienda][data-tda-state="demorado"] .tda-status[data-tone="error"]::before { -webkit-mask-image: var(--tda-ico-clock); mask-image: var(--tda-ico-clock); }
[data-tienda] .tda-status[data-tone="ok"]::before { -webkit-mask-image: var(--tda-ico-check); mask-image: var(--tda-ico-check); }
[data-tienda] .tda-status:empty, [data-tienda] .tda-status[hidden] { display: none; }
[data-tienda] .tda-status--inline { margin: 8px 0 0; padding: 8px 10px; }

/* Aviso de modo prueba */
[data-tienda] .tda-test { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 24px; background: var(--w-warning-soft); color: var(--w-warning); font: 600 13px/1.35 var(--w-font); }
[data-tienda] .tda-test::before { content: ""; flex: none; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--tda-ico-alert) center / contain no-repeat; mask: var(--tda-ico-alert) center / contain no-repeat; }
[data-tienda] .tda-checkout .tda-test { margin: 0 0 14px; padding: 8px 12px; border-radius: var(--w-radius); }

/* Línea de seguridad: el texto dice lo mismo, con su candado */
[data-tienda] .tda-secure { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; margin: 0; padding: 12px 14px; border: 1px solid var(--w-line); border-radius: 12px; color: var(--w-muted); font-size: 13px; line-height: 1.55; text-align: left; }
[data-tienda] .tda-secure .tda-ico { width: 18px; height: 18px; margin-top: 1px; color: var(--w-ink-2); }
[data-tienda] .tda-secure strong { color: var(--w-ink); font-weight: 600; }

/* Botón de pago: candado; mientras prepara el pago, un giro discreto */
[data-tienda] .tda-paybtn { min-height: 56px; height: auto; padding-block: 12px; gap: 10px; font-size: 16px; font-weight: 600; line-height: 1.3; white-space: normal; text-wrap: balance; }
[data-tienda] .tda-paybtn::before { content: ""; flex: none; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--tda-ico-lock) center / contain no-repeat; mask: var(--tda-ico-lock) center / contain no-repeat; }
[data-tienda] .tda-paybtn[aria-busy="true"]::before { -webkit-mask: none; mask: none; background: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tda-spin .7s linear infinite; }
[data-tienda] .tda-paybtn:disabled:not([aria-busy="true"]) { border-color: var(--w-line); background: var(--w-surface-2); color: var(--w-muted); box-shadow: none; opacity: 1; }
[data-tienda] .tda-paybtn:disabled:not([aria-busy="true"])::after { display: none; }

/* El comprobante */
[data-tienda] .tda-receipt { position: relative; display: block; min-width: 0; margin: 0; padding-bottom: 16px; border: 1px solid var(--w-line); border-radius: 18px; background: var(--w-surface); color: var(--w-ink); box-shadow: var(--w-shadow); overflow: hidden; text-align: left; }
[data-tienda] .tda-receipt::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--tda-accent); }
.tda-receipt__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding: 22px 24px 18px; border-bottom: 1px dashed var(--w-line-strong); }
[data-tienda] .tda-receipt__head p { margin: 0; }
[data-tienda] .tda-receipt__label { margin: 0 0 6px; color: var(--w-muted); font: 500 11px/1.3 var(--w-font-mono); letter-spacing: .14em; text-transform: uppercase; }
[data-tienda] .tda-receipt__number { margin: 0; font: 600 22px/1.1 var(--w-font-mono); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tda-receipt__rows { display: grid; gap: 12px; margin: 0; padding: 20px 24px; }
.tda-receipt__rows > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: baseline; }
.tda-receipt__rows dt { color: var(--w-muted); font-size: 14px; line-height: 1.45; }
.tda-receipt__rows dd { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.tda-receipt__rows dd.is-mono { font: 500 14px/1.45 var(--w-font-mono); }
.tda-receipt__rows [data-tda-detail] { color: var(--w-ink-2); font-weight: 400; }
/* Un cobro pagado, anulado o cancelado ya no «vence»: esa fila solo confunde en el comprobante. */
:is([data-tda-state="pagado"], [data-tda-state="anulado"], [data-tda-state="cancelado"]) [data-tda-expires-row] { display: none; }
.tda-receipt__total { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 0 16px; padding: 16px; border-radius: 12px; background: var(--w-surface-2); }
.tda-receipt__total dt { color: var(--w-ink); font-size: 15px; font-weight: 600; }
.tda-receipt__total dd { margin: 0 0 0 auto; font: 600 clamp(26px, 3.2vw, 34px)/1.1 var(--w-font-mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.tda-receipt__pay { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px 24px 8px; }
[data-tienda] .tda-receipt__pay .tda-status { margin: 0; }
.tda-receipt__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 16px; padding: 18px 24px 6px; }
.tda-receipt__foot:empty { display: none; }
[data-tienda] .tda-receipt__foot .tda-foot-note { margin: 0; }
[data-tienda] .tda-receipt__foot [data-tda-delivery]:empty, [data-tienda] .tda-receipt__foot [data-tda-delivery]:has(> .tda-delivery:empty) { display: none; }
[data-tienda] .tda-receipt__foot [data-tda-delivery] { flex: 1 1 100%; }
[data-tienda] .tda-delivery { gap: 8px; }
[data-tienda] .tda-delivery .w-btn { box-sizing: border-box; min-width: 220px; }
[data-tienda] .tda-delivery .tda-hint { margin: 0; }
[data-tienda] .tda-print { display: none; gap: 8px; }
[data-tienda][data-tda-state="pagado"] .tda-print { display: inline-flex; }
[data-tienda^="cobro"] .tda-receipt__foot { display: none; }
[data-tienda^="cobro"][data-tda-state="pagado"] .tda-receipt__foot { display: flex; padding-top: 18px; }
.tda-print-only { display: none; }

/* Etiqueta de estado del comprobante */
.tda-badge { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 11px 7px 9px; border-radius: 999px; background: var(--tda-tone-soft); color: var(--tda-tone); font: 600 12.5px/1 var(--w-font); white-space: nowrap; }
.tda-badge::before { content: ""; flex: none; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--tda-badge-ico) center / contain no-repeat; mask: var(--tda-badge-ico) center / contain no-repeat; }
.tda-badge__t { display: none; }
[data-tda-state="cargando"] .tda-badge__t--cargando, [data-tda-state="pendiente"] .tda-badge__t--pendiente, [data-tda-state="sin-pasarela"] .tda-badge__t--sin-pasarela,
[data-tda-state="esperando"] .tda-badge__t--esperando, [data-tda-state="demorado"] .tda-badge__t--demorado, [data-tda-state="pagado"] .tda-badge__t--pagado,
[data-tda-state="vencido"] .tda-badge__t--vencido, [data-tda-state="anulado"] .tda-badge__t--anulado, [data-tda-state="cancelado"] .tda-badge__t--cancelado,
[data-tda-state="fallido"] .tda-badge__t--fallido, [data-tda-state="reembolsado"] .tda-badge__t--reembolsado, [data-tda-state="bloqueado"] .tda-badge__t--bloqueado { display: inline; }
[data-tda-state="error"] .tda-badge { display: none; }

/* Marca de estado: puntos mientras espera; círculo y tilde al confirmarse; un ícono por estado */
.tda-mark { position: relative; display: none; flex: none; width: 64px; height: 64px; margin: 0 0 22px; color: var(--tda-tone); }
.tda-mark__disc, .tda-mark__pulse { position: absolute; inset: 0; border-radius: 50%; }
.tda-mark__disc { background: var(--tda-tone-soft); }
.tda-mark__pulse { inset: -1px; border: 2px solid var(--tda-accent); opacity: 0; pointer-events: none; }
.tda-mark__svg { position: absolute; inset: 0; display: none; width: 100%; height: 100%; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.tda-mark__ring, .tda-mark__tick { stroke-dasharray: 100; stroke-dashoffset: 0; }
.tda-mark__dots { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 6px; }
.tda-mark__dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
[data-tda-state] .tda-mark { display: block; }
:is([data-tda-state="pendiente"], [data-tda-state="sin-pasarela"]) .tda-mark, [data-tienda="cobro"][data-tda-state="cargando"] .tda-mark { display: none; }
:is([data-tda-state="cargando"], [data-tda-state="esperando"]) .tda-mark__dots { display: flex; }
[data-tda-state="pagado"] .tda-mark__svg--ok,
:is([data-tda-state="vencido"], [data-tda-state="demorado"]) .tda-mark__svg--wait,
:is([data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="fallido"]) .tda-mark__svg--stop,
:is([data-tda-state="error"], [data-tda-state="bloqueado"]) .tda-mark__svg--alert,
[data-tda-state="reembolsado"] .tda-mark__svg--back { display: block; }
@media (prefers-reduced-motion: no-preference) {
  :is([data-tda-state="cargando"], [data-tda-state="esperando"]) .tda-mark__dots i { animation: tda-dot 1.2s ease-in-out infinite; }
  .tda-mark__dots i:nth-child(2) { animation-delay: .16s; }
  .tda-mark__dots i:nth-child(3) { animation-delay: .32s; }
}

/* Pasos: 1 Revisá · 2 Pagá en Stripe · 3 Recibís el comprobante (la barra es la franja) */
.tda-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; max-width: 460px; margin: 28px 0 0; padding: 0; list-style: none; text-align: left; }
.tda-step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 8px; align-content: start; align-items: baseline; color: var(--w-muted); font-size: 13.5px; line-height: 1.3; }
.tda-step__bar { grid-column: 1 / -1; height: 5px; margin: 0 3px; border-radius: 1.5px; background: var(--w-line-strong); transform: skewX(-21deg); }
.tda-step__n { font: 600 12px/1.3 var(--w-font-mono); }
.tda-step__t { font-weight: 500; }
/* paso actual: franja llena y texto en tinta; hecho: franja más suave */
[data-tienda="cobro"] .tda-step:nth-child(1), [data-tienda="cobro-gracias"] .tda-step:nth-child(3), [data-tda-state="pagado"] .tda-step { color: var(--w-ink); }
[data-tienda="cobro"] .tda-step:nth-child(1) .tda-step__bar, [data-tienda="cobro-gracias"] .tda-step:nth-child(3) .tda-step__bar, [data-tda-state="pagado"] .tda-step .tda-step__bar { background: var(--tda-accent); }
[data-tienda="cobro"] .tda-step:nth-child(1) .tda-step__n, [data-tienda="cobro-gracias"] .tda-step:nth-child(3) .tda-step__n, [data-tda-state="pagado"] .tda-step__n { color: var(--tda-accent-ink); }
[data-tienda="cobro-gracias"] .tda-step:nth-child(-n+2) { color: var(--w-ink-2); }
[data-tienda="cobro-gracias"]:not([data-tda-state="pagado"]) .tda-step:nth-child(-n+2) .tda-step__bar { background: color-mix(in srgb, var(--tda-accent) 45%, var(--w-line)); }
:is([data-tda-state="vencido"], [data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="fallido"], [data-tda-state="error"], [data-tda-state="reembolsado"], [data-tda-state="demorado"], [data-tda-state="bloqueado"]) .tda-steps, [data-tienda="cobro-gracias"][data-tda-state="pagado"] .tda-steps { display: none; }

/* Ayuda por WhatsApp: discreta mientras todo va bien; botón claro cuando hay que hacer algo */
.tda-help { display: block; margin: 28px 0 0; color: var(--w-muted); font-size: 14px; line-height: 1.5; }
.tda-help .tda-ico { display: inline-block; margin-right: 6px; vertical-align: -4px; color: var(--w-muted); }
.tda-help a, [data-tienda] .tda-foot-note a, .tda-fallback__link { color: var(--tda-accent-ink); font-weight: 600; text-underline-offset: 3px; }
.tda-fallback { display: none; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 24px 0 0; }
.tda-fallback .w-btn { gap: 8px; }
.tda-fallback__link { display: none; font-size: 14px; }
:is([data-tda-state="sin-pasarela"], [data-tda-state="vencido"], [data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="fallido"], [data-tda-state="error"], [data-tda-state="demorado"], [data-tda-state="reembolsado"], [data-tda-state="bloqueado"]) .tda-fallback { display: flex; }
:is([data-tda-state="sin-pasarela"], [data-tda-state="vencido"], [data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="fallido"], [data-tda-state="error"], [data-tda-state="demorado"], [data-tda-state="reembolsado"], [data-tda-state="bloqueado"]) .tda-help { display: none; }
/* /tienda/gracias: con el comprobante a la vista, su pie ya trae «Ayuda por WhatsApp». */
[data-tienda="gracias"]:not([data-tda-state="error"]) .tda-fallback .w-btn { display: none; }
[data-tienda="gracias"]:is([data-tda-state="fallido"], [data-tda-state="error"]) .tda-fallback__link { display: inline; }
:is([data-tda-state="vencido"], [data-tda-state="anulado"], [data-tda-state="cancelado"], [data-tda-state="pagado"]) .tda-receipt__pay { display: none; }
[data-tda-state="bloqueado"] .tda-secure { display: none; }

/* /pagar: explicación a la izquierda, comprobante a la derecha */
.tda-pay { padding: clamp(28px, 6vw, 80px) 0 clamp(56px, 8vw, 104px); }
.tda-pay__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); grid-template-areas: "intro side" "after side"; grid-template-rows: auto 1fr; gap: 0 clamp(32px, 6vw, 88px); align-items: start; }
.tda-pay__intro { grid-area: intro; }
.tda-pay__side { grid-area: side; }
.tda-pay__after { grid-area: after; min-width: 0; }
.tda-pay__after .tda-help { margin-top: 24px; }
.tda-pay__intro { min-width: 0; max-width: 520px; padding-top: 6px; }
.tda-pay__intro .tda-mark { width: 52px; height: 52px; margin-bottom: 20px; }
[data-tienda] .tda-pay__intro h1 { margin: 12px 0 14px; font-size: clamp(32px, 4.4vw, 52px); line-height: 1.05; text-wrap: balance; }
[data-tienda] .tda-pay__intro .tda-lead { margin: 0; font-size: clamp(16px, 1.6vw, 18px); line-height: 1.6; }
.tda-pay__side { min-width: 0; }
[data-tda-state="error"] .tda-pay__grid { grid-template-columns: minmax(0, 560px); grid-template-areas: "intro" "after"; justify-content: center; }
[data-tda-state="error"] .tda-pay__side { display: none; }
.tda-receipt--ghost { display: none !important; }
[data-tda-state="cargando"] .tda-receipt--ghost { display: grid !important; gap: 16px; min-height: 380px; padding: 28px 24px; align-content: start; }
.tda-receipt--ghost span { display: block; height: 14px; border-radius: 6px; background: var(--w-surface-2); }
.tda-receipt--ghost span:nth-child(1) { width: 38%; height: 26px; margin-bottom: 18px; }
.tda-receipt--ghost span:nth-child(2) { width: 86%; }
.tda-receipt--ghost span:nth-child(3) { width: 64%; }
.tda-receipt--ghost span:nth-child(4) { height: 64px; margin-top: 18px; border-radius: 12px; }

/* /pagar/gracias y /tienda/gracias: columna centrada */
.tda-done { padding: clamp(36px, 7vw, 96px) 0 clamp(56px, 8vw, 104px); }
.tda-done__col { display: flex; flex-direction: column; align-items: center; width: min(600px, 100% - 32px); text-align: center; }
[data-tienda] .tda-done__col h1 { margin: 12px 0 14px; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.06; text-wrap: balance; }
[data-tienda] .tda-done__col .tda-lead { max-width: 46ch; margin: 0; font-size: clamp(16px, 1.6vw, 18px); line-height: 1.6; }
[data-tienda] .tda-done__col .tda-status { display: inline-flex; margin-top: 18px; }
[data-tienda] .tda-done__col .tda-status[data-tone="ok"] { margin-top: 14px; padding: 0; border: 0; background: none; font: 500 13.5px/1.5 var(--w-font-mono); color: color-mix(in srgb, var(--w-success) 75%, var(--w-ink)); }
[data-tienda] .tda-done__col .tda-status:empty, [data-tienda] .tda-done__col .tda-status[hidden] { display: none; }
.tda-done__col .tda-steps { margin-top: 24px; }
.tda-done__col .tda-receipt { width: 100%; margin-top: 32px; }
.tda-done__col .tda-fallback { justify-content: center; }
[data-tda-state="esperando"] .tda-receipt { display: none; }

/* Animación de pago confirmado (solo en las páginas de vuelta). Menos de 1,2 s, una sola vez:
   círculo 0,05–0,47 s · tilde 0,40–0,72 s · pulso naranja 0,62–1,12 s · comprobante 0,62–1,07 s. */
@media (prefers-reduced-motion: no-preference) {
  /* Entrada sobria del comprobante y de la marca en cualquier estado (antes que la celebración, que la reemplaza). */
  [data-tienda] .tda-receipt:not(.tda-receipt--ghost), [data-tienda] .tda-mark { animation: tda-fade .3s var(--tda-ease) both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] .tda-mark__disc { animation: tda-pop .36s var(--tda-ease) both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] .tda-mark__ring { animation: tda-draw .42s cubic-bezier(.65, 0, .35, 1) .05s both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] .tda-mark__tick { animation: tda-draw .32s cubic-bezier(.65, 0, .35, 1) .4s both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] .tda-mark__pulse { animation: tda-pulse .5s ease-out .62s both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] :is(h1, .tda-lead, .tda-status) { animation: tda-fade .36s var(--tda-ease) .12s both; }
  :is([data-tienda="cobro-gracias"], [data-tienda="gracias"])[data-tda-state="pagado"] .tda-receipt { animation: tda-rise .45s var(--tda-ease) .62s both; }
}
@keyframes tda-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes tda-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes tda-pulse { 0% { opacity: 0; transform: scale(1); } 12% { opacity: .7; } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes tda-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tda-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes tda-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes tda-spin { to { transform: rotate(360deg); } }

/* Tienda: catálogo, producto, pasarela de prueba */
[data-tienda] .tda-back a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }
[data-tienda] .tda-back a:hover { text-decoration: underline; text-underline-offset: 3px; }
[data-tienda="catalogo"] .tda-status { justify-content: center; margin: 0 0 20px; padding: 40px 24px; border-style: dashed; border-color: var(--w-line-strong); font-size: 16px; color: var(--w-ink-2); }
[data-tienda="catalogo"] .tda-grid:empty { display: none; }
[data-tienda] .tda-checkout { overflow: hidden; border-radius: 18px; }
[data-tienda] .tda-checkout::before { content: ""; display: block; height: 3px; background: var(--tda-accent); }
[data-tienda] .tda-summary__total dd { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
[data-tienda="pago-prueba"] .tda-receipt__pay .tda-actions { justify-content: stretch; }
[data-tienda="pago-prueba"] .tda-receipt__pay .tda-actions .w-btn { flex: 1 1 180px; }

@media (max-width: 900px) {
  .tda-pay__grid, [data-tda-state="error"] .tda-pay__grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "side" "after"; grid-template-rows: auto; }
  .tda-pay__intro { max-width: none; margin-bottom: 28px; }
  .tda-pay__after .tda-help { text-align: center; }
}
@media (max-width: 520px) {
  .tda-receipt__head { padding: 20px 18px 16px; }
  .tda-receipt__rows { padding: 18px; }
  .tda-receipt__rows > div { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
  .tda-receipt__total { margin: 0 12px; padding: 14px; }
  .tda-receipt__pay { padding: 18px 18px 4px; }
  .tda-receipt__foot { padding: 16px 18px 4px; }
  [data-tienda] .tda-test { padding: 9px 18px; }
  .tda-steps { gap: 10px; }
  .tda-step { font-size: 12.5px; }
  .tda-print, .tda-fallback .w-btn, [data-tienda] .tda-delivery, [data-tienda] .tda-delivery .w-btn { box-sizing: border-box; width: 100%; min-width: 0; justify-content: center; }
}

/* Comprobante impreso o en PDF: solo el comprobante, en blanco y negro, sin encabezado ni pie */
@media print {
  @page { margin: 16mm; }
  html:has(main[data-tienda]), body:has(main[data-tienda]) { background: #fff !important; }
  body:has(main[data-tienda]) > :not(main) { display: none !important; }
  /* Impreso desde modo oscuro: tinta negra sobre papel blanco, sin los colores del tema. */
  [data-tienda] { --w-ink: #000; --w-ink-2: #222; --w-muted: #444; --w-success: #000; --w-danger: #000; --w-warning: #000; --w-surface: #fff; --w-surface-2: #fff; --w-line: #999; --w-line-strong: #999; --tda-tone: #000; --tda-tone-soft: #fff; color: #000; }
  [data-tienda] *, [data-tienda] *::before, [data-tienda] *::after { animation: none !important; transition: none !important; box-shadow: none !important; }
  .tda-pay, .tda-done { padding: 0; }
  .tda-pay__grid { display: block; }
  .tda-pay__intro > :not(.tda-status), .tda-pay__after, .tda-done__col > :not(.tda-receipt):not(.tda-status), .tda-receipt__pay, .tda-receipt__foot, .tda-receipt--ghost { display: none !important; }
  [data-tienda] .tda-test { border-bottom: 1px solid #888; background: none; color: #000; }
  .tda-done__col { display: block; width: auto; text-align: left; }
  [data-tienda] .tda-status { margin: 0 0 12px; border: 0; padding: 0; background: none; color: #000; }
  [data-tienda] .tda-receipt { max-width: 560px; border: 1px solid #888; border-radius: 10px; background: #fff; color: #000; break-inside: avoid; }
  [data-tienda] .tda-receipt::before { display: none; }
  [data-tda-state="pagado"] .tda-print-only { display: block; margin: 0; padding: 16px 24px 0; font: 600 12px/1.4 var(--w-font-mono); letter-spacing: .08em; text-transform: uppercase; }
  .tda-receipt__rows dt, [data-tienda] .tda-receipt__label { color: #444; }
  .tda-receipt__total { background: none; border: 1px solid #888; }
  .tda-badge { border: 1px solid #888; background: none; color: #000; }
  .tda-done__col .tda-receipt { margin: 0; }
}

/* Movimiento reducido: todo aparece directo y completo */
@media (prefers-reduced-motion: reduce) {
  [data-tienda] *, [data-tienda] *::before, [data-tienda] *::after { animation: none !important; transition: none !important; }
}

/* Panel /admin/tienda */
.tda-admin { width: min(1240px, 100% - 32px); margin-inline: auto; padding: 24px 0 64px; }
.tda-admin__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.tda-admin__title { margin: 0 auto 0 0; font-size: 22px; }
.tda-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--w-line); overflow-x: auto; }
.tda-tab { padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--w-muted); font: 600 14px/1 var(--w-font); cursor: pointer; white-space: nowrap; }
.tda-tab[aria-selected="true"] { color: var(--w-ink); border-bottom-color: var(--w-accent); }
.tda-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tda-kpi { padding: 16px; border: 1px solid var(--w-line); border-radius: var(--w-radius-lg); background: var(--w-surface); }
.tda-kpi span { display: block; color: var(--w-muted); font-size: 13px; }
.tda-kpi strong { display: block; margin-top: 6px; font: 600 22px/1.2 var(--w-font-mono); }
.tda-kpi small { display: block; margin-top: 4px; color: var(--w-muted); }
.tda-admin__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tda-top { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.tda-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tda .tda-toolbar > * { flex: 0 0 auto; width: auto; }
.tda .tda-toolbar .w-input[type="search"] { flex: 1 1 260px; min-width: 0; }
.tda-admin .w-table td { vertical-align: top; }
.tda-admin .w-table td small { display: block; color: var(--w-muted); }
.tda-row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tda-coupon-form { margin-bottom: 16px; }
.tda-form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.tda-span { grid-column: 1 / -1; }
.tda-dialog { width: min(760px, 100% - 24px); max-height: calc(100dvh - 24px); padding: 24px; border: 1px solid var(--w-line); border-radius: var(--w-radius-lg); background: var(--w-surface); color: var(--w-ink); }
.tda-dialog::backdrop { background: rgba(11, 13, 18, .5); }
.tda-dialog textarea { min-height: 120px; resize: vertical; }
.tda-events { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--w-ink-2); }
