/* ==========================================================================
   BILLING / PAGOS — compra de keys con Stripe Checkout
   Dueño: agente PAYMENTS. Se carga en los headers (panel y admin) despues de
   style.css + glass.css + dashboard.css + pages-*.css.

   Port del diseño "pyment" (checkout de 2 columnas con Lottie de billetera,
   pasos numerados, logos de tarjetas, boton de pago con Lottie de tarjeta,
   loader, tarjeta virtual en dos mitades que se juntan + particulas + check)
   recoloreado a la paleta del sistema: rojo de marca (#ff3947), rojo
   profundo (#a01a26), superficies oscuras de vidrio. El verde (#35d28a)
   aparece SOLO en el estado de exito.

   Reglas: TODO selector empieza con .bill- (no se filtra a otras paginas),
   funciona en tema claro (html[data-theme="light"]), a 360px sin scroll
   horizontal, y respeta prefers-reduced-motion.
   ========================================================================== */

/* Angulo animable del borde "cometa" de la tarjeta de licencia. */
@property --bill-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.bill-page {
  --bill-glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.055) 0%, rgba(24, 24, 27, 0.78) 42%, rgba(13, 13, 15, 0.9) 100%);
  --bill-glass-border: rgba(255, 255, 255, 0.09);
  --bill-glass-hi: rgba(255, 255, 255, 0.07);
  --bill-inner: rgba(255, 255, 255, 0.035);
  --bill-inner-strong: rgba(255, 255, 255, 0.06);
  --bill-inner-border: rgba(255, 255, 255, 0.08);
  --bill-text: var(--text);
  --bill-muted: var(--muted);
  --bill-muted-2: var(--muted-2);
  --bill-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85), 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --bill-blur: 22px;
  --bill-red-grad: linear-gradient(135deg, #ff3947 0%, #d42a38 48%, #a01a26 100%);
  container: bill / inline-size;
  color: var(--bill-text);
}

html[data-theme="light"] .bill-page {
  --bill-glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 55%, rgba(251, 247, 244, 0.95) 100%);
  --bill-glass-border: #e4e0d8;
  --bill-glass-hi: rgba(255, 255, 255, 0.9);
  --bill-inner: #faf8f5;
  --bill-inner-strong: #f3efe9;
  --bill-inner-border: #e8e3da;
  --bill-text: #1a1a1a;
  --bill-muted: #5f5f63;
  --bill-muted-2: #7c7c80;
  --bill-shadow: 0 24px 60px -32px rgba(160, 26, 38, 0.28), 0 8px 24px -14px rgba(0, 0, 0, 0.1);
}

.bill-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- vidrio base ---------- */

.bill-glass {
  position: relative;
  background: var(--bill-glass-bg);
  border: 1px solid var(--bill-glass-border);
  border-radius: 26px;
  box-shadow: var(--bill-shadow), inset 0 1px 0 var(--bill-glass-hi);
  -webkit-backdrop-filter: blur(var(--bill-blur)) saturate(140%);
  backdrop-filter: blur(var(--bill-blur)) saturate(140%);
  isolation: isolate;
  overflow: hidden;
}
/* Orbes ambientales (quedan adentro de la tarjeta: overflow hidden). */
.bill-glass::before,
.bill-glass::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.bill-glass::before {
  width: 420px; height: 420px; top: -210px; left: -150px;
  background: radial-gradient(circle, rgba(255, 57, 71, 0.2) 0%, rgba(255, 57, 71, 0) 65%);
}
.bill-glass::after {
  width: 380px; height: 380px; bottom: -220px; right: -140px;
  background: radial-gradient(circle, rgba(160, 26, 38, 0.28) 0%, rgba(160, 26, 38, 0) 65%);
}
html[data-theme="light"] .bill-glass::before { background: radial-gradient(circle, rgba(255, 57, 71, 0.1) 0%, rgba(255, 57, 71, 0) 65%); }
html[data-theme="light"] .bill-glass::after { background: radial-gradient(circle, rgba(160, 26, 38, 0.08) 0%, rgba(160, 26, 38, 0) 65%); }

/* Esquinas "neon" del diseño glassy. */
.bill-corner {
  position: absolute; width: 16px; height: 16px; pointer-events: none;
  border: 2px solid var(--accent); opacity: 0.75;
  filter: drop-shadow(0 0 6px rgba(255, 57, 71, 0.55));
}
.bill-corner-tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.bill-corner-tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.bill-corner-bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.bill-corner-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }

/* ==========================================================================
   /panel/billing — checkout
   ========================================================================== */

.bill-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  padding: 26px;
  margin-bottom: 18px;
}
@container bill (min-width: 820px) {
  .bill-checkout {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 36px;
    padding: 32px 34px;
  }
}

/* ---------- columna izquierda: info ---------- */

.bill-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; transition: opacity 0.45s ease; }
.bill-lottie { display: block; pointer-events: none; }
.bill-lottie svg { display: block; }
.bill-lottie-wallet { width: 132px; height: 132px; margin: -10px auto -14px 0; }

.bill-h {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 600; line-height: 1.1; margin: 0 0 4px;
  background: linear-gradient(135deg, #ff6b75 0%, var(--accent) 45%, #d42a38 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.bill-sub { color: var(--bill-muted); font-size: 15px; line-height: 1.45; }

.bill-steps {
  list-style: none; margin: 0; padding: 18px;
  display: flex; flex-direction: column; gap: 16px;
  border-radius: 18px;
  background: var(--bill-inner);
  border: 1px solid var(--bill-inner-border);
}
.bill-steps li { display: flex; gap: 12px; font-size: 14px; line-height: 1.5; color: var(--bill-text); min-width: 0; }
.bill-steps li > div { min-width: 0; flex: 1; }
.bill-step-n {
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--bill-red-grad);
  box-shadow: 0 0 14px rgba(255, 57, 71, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.bill-cards {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px; padding: 10px;
  border-radius: 12px;
  background: var(--bill-inner-strong);
  border: 1px solid var(--bill-inner-border);
}
/* Tarjetas aceptadas en texto (los logos de las marcas tienen reglas de uso propias). */
.bill-card-name {
  display: inline-flex; align-items: center; min-height: 30px; padding: 4px 11px; border-radius: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.01em; color: var(--bill-text);
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}

.bill-privacy { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--bill-muted); }
.bill-privacy svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }
.bill-secure {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 6px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 600; color: var(--bill-muted);
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}
.bill-secure svg { width: 14px; height: 14px; color: var(--success); }

/* ---------- columna derecha: form ---------- */

.bill-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; margin: 0; transition: opacity 0.45s ease; }
.bill-label {
  display: block; margin: 0 0 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--bill-muted-2);
}

.bill-periods {
  display: flex; gap: 4px; padding: 4px;
  border-radius: 9999px;
  background: var(--bill-inner);
  border: 1px solid var(--bill-inner-border);
}
.bill-period-btn {
  flex: 1 1 0; min-width: 0; min-height: 42px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 10px; border-radius: 9999px;
  font-size: 13px; font-weight: 600; color: var(--bill-muted);
  border: 1px solid transparent; text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bill-period-btn:hover { color: var(--bill-text); }
.bill-period-btn.is-active {
  color: #fff;
  background: var(--bill-red-grad);
  box-shadow: 0 8px 20px -8px rgba(255, 57, 71, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.bill-plans { display: flex; flex-direction: column; gap: 10px; }
.bill-plan {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bill-inner);
  border: 1px solid var(--bill-inner-border);
  color: var(--bill-text);
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  transition: border-color 0.15s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.bill-plan[hidden] { display: none; }
.bill-plan:hover { border-color: rgba(255, 57, 71, 0.45); }
.bill-plan-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.bill-plan.is-selected,
.bill-plan:has(.bill-plan-radio:checked) {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 57, 71, 0.16) 0%, rgba(160, 26, 38, 0.08) 100%);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 30px -16px rgba(255, 57, 71, 0.6);
}
.bill-plan:has(.bill-plan-radio:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.bill-plan-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(255, 57, 71, 0.25);
}
.bill-plan-icon svg { width: 18px; height: 18px; }
.bill-plan-exclusive .bill-plan-icon { background: linear-gradient(135deg, #a01a26, #4a0c12); color: #ffd0d4; border-color: rgba(255, 57, 71, 0.4); }
.bill-plan-free .bill-plan-icon { background: var(--bill-inner-strong); color: var(--bill-muted); border-color: var(--bill-inner-border); }
.bill-plan-body { min-width: 0; }
.bill-plan-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 15px; font-weight: 700; color: var(--bill-text); }
.bill-plan-blurb { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--bill-muted); }
.bill-plan-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: var(--bill-red-grad);
}
.bill-plan-price { text-align: right; white-space: nowrap; font-size: 18px; font-weight: 700; color: var(--bill-text); line-height: 1.15; }
.bill-plan-price small { display: block; font-size: 11.5px; font-weight: 500; color: var(--bill-muted-2); }
.bill-plan-tick {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--bill-inner-border);
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bill-plan-tick svg { width: 12px; height: 12px; }
.bill-plan.is-selected .bill-plan-tick,
.bill-plan:has(.bill-plan-radio:checked) .bill-plan-tick {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 10px rgba(255, 57, 71, 0.55);
}
.bill-plan.is-static { cursor: default; }
.bill-plan.is-static:hover { border-color: var(--bill-inner-border); }
.bill-plan.is-unavailable { opacity: 0.55; }
.bill-plan-link { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.bill-plan-link:hover { text-decoration: underline; }

.bill-field { min-width: 0; }
.bill-field select {
  width: 100%; min-height: 46px; border-radius: 14px;
  background-color: var(--bill-inner-strong); border-color: var(--bill-inner-border); color: var(--bill-text);
}
/* La flecha del select es un background-image (glass.css); el shorthand
   "background" del tema claro en style.css resetea el repeat y la flecha
   se repetia en mosaico. Dentro de las paginas de billing se fija aca. */
.bill-page select,
html[data-theme="light"] .bill-page select {
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 14px 14px;
}
.bill-hint { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--bill-muted-2); }

.bill-summary {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--bill-inner);
  border: 1px dashed rgba(255, 57, 71, 0.3);
}
.bill-summary-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bill-muted-2); }
.bill-summary dl { margin: 0; }
.bill-summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 13.5px; }
.bill-summary-row dt { color: var(--bill-muted); }
.bill-summary-row dd { margin: 0; text-align: right; font-weight: 600; color: var(--bill-text); min-width: 0; overflow-wrap: anywhere; }
.bill-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 8px; padding-top: 10px;
  border-top: 1px solid var(--bill-inner-border);
  font-size: 14px; color: var(--bill-muted);
}
.bill-total strong { font-size: 26px; font-weight: 700; color: var(--bill-text); letter-spacing: -0.02em; }

.bill-pay-row { display: flex; align-items: center; gap: 10px; }
.bill-pay-btn {
  flex: 1 1 auto; min-width: 0; min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 14px;
  background: var(--bill-red-grad);
  color: #fff; font-family: var(--font-body); font-size: 15.5px; font-weight: 700;
  box-shadow: 0 12px 28px -10px rgba(255, 57, 71, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-decoration: none;
}
.bill-pay-btn:hover { box-shadow: 0 16px 34px -10px rgba(255, 57, 71, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3); filter: brightness(1.05); }
.bill-pay-btn:active { transform: translateY(1px); }
.bill-pay-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; filter: none; }
.bill-pay-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.bill-pay-btn.is-block { width: 100%; }
.bill-lottie-swipe { flex: 0 0 92px; width: 92px; height: 92px; margin: -16px 0 -12px; }
.bill-redirect-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--bill-muted-2); text-align: center; }
.bill-redirect-note svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Loader "Processing" del diseño pyment: al enviar, las dos columnas se
   desvanecen y aparece el spinner hasta que el navegador sale a Stripe. */
.bill-processing {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  text-align: center; padding: 24px;
  font-size: 17px; font-weight: 600; letter-spacing: 0.02em; color: var(--bill-text);
}
.bill-processing[hidden] { display: none; }
.bill-checkout.is-processing .bill-info,
.bill-checkout.is-processing .bill-form { opacity: 0; pointer-events: none; }

.bill-spinner {
  width: 50px; height: 50px; border-radius: 50%;
  border: 4px solid rgba(255, 57, 71, 0.16);
  border-left-color: var(--accent);
  animation: bill-spin 1s linear infinite;
}
@keyframes bill-spin { to { transform: rotate(360deg); } }

/* Estado "pagos no disponibles" */
.bill-unavailable {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 22px; border-radius: 18px;
  background: var(--warning-soft);
  border: 1px solid rgba(255, 177, 59, 0.32);
}
.bill-unavailable-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 177, 59, 0.18); color: var(--warning);
}
.bill-unavailable-icon svg { width: 20px; height: 20px; }
.bill-unavailable h2 { font-family: var(--font-body); font-size: 17px; font-weight: 700; color: var(--bill-text); margin: 0; }
.bill-unavailable p { font-size: 14px; line-height: 1.5; color: var(--bill-muted); margin: 0; }
html[data-theme="light"] .bill-unavailable { background: #fff6e8; }

/* ---------- Tebex (tienda externa, el pago no pasa por el panel) ---------- */

.bill-tebex { margin-bottom: 18px; }
.bill-tebex-body { display: flex; flex-direction: column; gap: 14px; }
.bill-tebex-lead { margin: 0; font-size: 14px; line-height: 1.5; color: var(--bill-muted); }
.bill-tebex-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bill-tebex-actions .btn { min-height: 42px; }
.bill-tebex-store { margin-bottom: 16px; max-width: 520px; }
.bill-tebex-store input[type=url] { min-height: 42px; font-family: var(--font-mono); }
.bill-pkg-fields input[type=text] { min-height: 42px; font-family: var(--font-mono); }
/* Free tiene un solo plan (de por vida): fila propia arriba, casilla angosta. */
.bill-pkg-grid .bill-pkg-free { grid-column: 1 / -1; }
.bill-pkg-free .bill-price-fields { grid-template-columns: minmax(0, 240px); }

/* ---------- historial de ordenes ---------- */

.bill-orders { margin-bottom: 18px; }
.bill-empty { padding: 22px 18px; font-size: 13.5px; color: var(--bill-muted-2); }
.bill-table { width: 100%; border-collapse: collapse; }
.bill-table th { white-space: nowrap; }
.bill-table td { vertical-align: middle; }
.bill-order-id { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 11px; color: var(--bill-muted-2); }
.bill-key-cell { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bill-key-cell .key-pill { overflow-wrap: anywhere; }
.bill-muted { color: var(--bill-muted-2); font-size: 12.5px; }

/* ==========================================================================
   /panel/billing/success — procesando / exito (tarjeta de licencia)
   ========================================================================== */

.bill-stage {
  padding: 30px 22px 32px;
  margin-bottom: 18px;
  text-align: center;
  overflow: hidden;
  overflow: clip;
}
@container bill (min-width: 700px) {
  .bill-stage { padding: 36px 40px 40px; }
}

.bill-stage-anim { display: flex; flex-direction: column; align-items: center; }

.bill-lottie-success {
  width: 104px; height: 104px; margin: 0 auto 6px;
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.bill-stage.is-landed .bill-lottie-success { opacity: 1; transform: none; }

/* Escenario de la tarjeta: mismo aspecto que la tarjeta de referencia (440x280)
   pero escalado al ancho disponible. Las unidades cqw de adentro se resuelven
   contra este ancho, asi que todo (texto, chip, distancias) escala junto. */
.bill-lcard-stage {
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 440 / 280;
  margin: 0 auto;
  container-type: inline-size;
  animation: bill-pop 0.75s ease-out 1.45s both;
}
.bill-lcard-half { position: absolute; inset: 0; }

/* Mitades con borde "roto" (clip-path dentado) que vuelan desde los costados. */
.bill-lcard-left {
  z-index: 2;
  clip-path: polygon(0% 0%, 50% 0%, 45% 15%, 52% 30%, 48% 45%, 55% 65%, 47% 85%, 50% 100%, 0% 100%);
  animation:
    bill-fly-left 1.15s cubic-bezier(0.18, 1.22, 0.42, 1) 0.3s both,
    bill-seal 0.2s ease-out 1.45s forwards;
}
.bill-lcard-right {
  z-index: 1;
  clip-path: polygon(100% 0%, 100% 100%, 50% 100%, 47% 85%, 55% 65%, 48% 45%, 52% 30%, 45% 15%, 50% 0%);
  animation:
    bill-fly-right 1.15s cubic-bezier(0.18, 1.22, 0.42, 1) 0.3s both,
    bill-fade-out 0.2s linear 1.6s forwards;
}
@keyframes bill-fly-left {
  0% { transform: translate(-150cqw, 70cqw) rotate(-35deg) scale(0.4); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes bill-fly-right {
  0% { transform: translate(150cqw, 70cqw) rotate(35deg) scale(0.4); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
/* Al juntarse, la mitad izquierda pasa a cubrir la tarjeta entera (sin
   costura) y al final se quita el recorte del todo: un clip-path rectangular
   tambien recortaria el brillo rojo (box-shadow) y las esquinas redondeadas
   se verian cuadradas. La mitad derecha ya no hace falta y se desvanece. */
@keyframes bill-seal {
  99% { clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 100%, 0% 100%); }
  100% { clip-path: none; }
}
@keyframes bill-fade-out { to { opacity: 0; visibility: hidden; } }
@keyframes bill-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ---------- la tarjeta de licencia ---------- */

.bill-lcard {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 20px;
  border-radius: 4.6cqw;
  padding: 26px;
  padding: 6.4cqw 6.8cqw;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 14px;
  font-size: 3.2cqw;
  background: linear-gradient(135deg, #ff4552 0%, #d42a38 42%, #a01a26 78%, #6e121b 100%);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(255, 255, 255, 0.18), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: bill-glow 0.6s ease-out 1.45s forwards;
}
.bill-lcard[data-tier="exclusive"] {
  background: linear-gradient(135deg, #3a0d12 0%, #2a1416 40%, #151517 75%, #0b0b0c 100%);
}
/* Textura: ruido mate + lineas curvas + malla de rombos (como la referencia). */
.bill-lcard::before {
  content: '';
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    radial-gradient(ellipse at 10% 120%, transparent 60%, rgba(255, 255, 255, 0.13) 61%, rgba(255, 255, 255, 0.13) 61.5%, transparent 62.5%),
    radial-gradient(ellipse at 90% -20%, transparent 60%, rgba(255, 255, 255, 0.13) 61%, rgba(255, 255, 255, 0.13) 61.5%, transparent 62.5%),
    linear-gradient(30deg, transparent 49%, rgba(255, 255, 255, 0.06) 49%, rgba(255, 255, 255, 0.06) 51%, transparent 51%),
    linear-gradient(-30deg, transparent 49%, rgba(255, 255, 255, 0.06) 49%, rgba(255, 255, 255, 0.06) 51%, transparent 51%);
  background-size: 100% 100%, 100% 100%, 40px 70px, 40px 70px;
  background-position: center;
}
/* Borde "cometa": aparece cuando las mitades se juntan. */
.bill-lcard::after {
  content: '';
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: inherit;
  padding: 3px;
  background:
    conic-gradient(from calc(180deg + var(--bill-angle)), transparent 320deg, rgba(255, 122, 132, 0.55) 345deg, #ffffff 360deg),
    conic-gradient(from calc(180deg - var(--bill-angle)), #ffffff 0deg, rgba(255, 122, 132, 0.55) 15deg, transparent 40deg);
  -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, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  animation: bill-comet-in 0.4s ease-out 1.45s forwards, bill-comet 1.5s ease-in-out 1.45s infinite alternate;
}
.bill-lcard > * { position: relative; z-index: 2; }
@keyframes bill-comet-in { to { opacity: 1; } }
@keyframes bill-comet { from { --bill-angle: 0deg; } to { --bill-angle: 180deg; } }
@keyframes bill-glow {
  to {
    box-shadow:
      0 25px 60px -12px rgba(255, 57, 71, 0.5),
      0 0 46px rgba(255, 57, 71, 0.35),
      0 0 90px rgba(255, 57, 71, 0.16),
      inset 0 1px 1px rgba(255, 255, 255, 0.18),
      inset 0 -1px 1px rgba(0, 0, 0, 0.45);
  }
}

.bill-lcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bill-lcard-brand {
  display: inline-flex; align-items: center; gap: 0.7em; min-width: 0;
  font-family: var(--font-body); font-weight: 700; letter-spacing: 0.14em; font-size: 0.86em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bill-lcard-brand svg { width: 1.5em; height: 1.5em; flex-shrink: 0; }
.bill-lcard-type {
  flex-shrink: 0; font-family: var(--font-body); font-size: 0.8em; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.3em 0.8em; border-radius: 9999px;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.28);
}
.bill-lcard-chiprow { display: flex; justify-content: space-between; align-items: center; }
.bill-lcard-chip {
  width: 3.6em; height: 2.6em; border-radius: 0.45em; overflow: hidden; position: relative;
  background: linear-gradient(135deg, #f1f1f3 0%, #cfcfd4 40%, #9a9aa2 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 -1px 2px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}
.bill-lcard-chip svg { width: 100%; height: 100%; display: block; }
.bill-lcard-nfc { width: 1.8em; height: 1.8em; margin-right: 1em; transform: rotate(90deg); }
.bill-lcard-number {
  font-size: 1.72em; letter-spacing: 0.08em; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.bill-lcard-details { display: flex; align-items: center; gap: 2.2em; font-size: 1em; letter-spacing: 0.12em; }
.bill-lcard-detail { display: flex; align-items: center; gap: 0.7em; min-width: 0; }
.bill-lcard-label {
  font-family: var(--font-body); font-size: 0.46em; line-height: 1.2; letter-spacing: 0.05em;
  text-align: right; text-transform: uppercase; opacity: 0.85;
}
.bill-lcard-value { font-size: 1.2em; letter-spacing: 0.1em; white-space: nowrap; text-transform: uppercase; }
.bill-lcard-holder {
  font-size: 1.1em; letter-spacing: 0.2em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- particulas (las crea billing.js al juntarse la tarjeta) ---------- */

.bill-particles { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 30; pointer-events: none; }
.bill-particle {
  position: absolute; left: 0; top: 0;
  width: var(--bill-s, 5px); height: var(--bill-s, 5px); border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ff3947, 0 0 20px rgba(255, 122, 132, 0.8);
  transform: translate(-50%, -50%) scale(0);
  animation: bill-particle var(--bill-d, 0.7s) ease-out forwards;
}
.bill-particle.is-red { background: #ff3947; }
.bill-particle.is-soft { background: #ffc2c7; }
@keyframes bill-particle {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  45% { transform: translate(calc(-50% + var(--bill-x) * 0.6), calc(-50% + var(--bill-y) * 0.6)) scale(1.5); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--bill-x)), calc(-50% + var(--bill-y))) scale(0); opacity: 0; }
}

/* ---------- mensaje "Payment successful" con check dibujado ---------- */

.bill-success-msg { margin-top: 22px; opacity: 0; animation: bill-fade-up 0.5s ease-out 1.5s forwards; }
.bill-check { width: 52px; height: 52px; margin: 0 auto; filter: drop-shadow(0 0 8px rgba(53, 210, 138, 0.45)); }
.bill-check svg { width: 100%; height: 100%; display: block; }
.bill-check-circle {
  fill: none; stroke: var(--success); stroke-width: 2;
  stroke-dasharray: 152; stroke-dashoffset: 152;
  animation: bill-draw 0.5s ease-out 1.7s forwards;
}
.bill-check-path {
  fill: none; stroke: var(--success); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 36; stroke-dashoffset: 36;
  animation: bill-draw 0.3s ease-out 2.2s forwards;
}
.bill-success-title {
  margin: 14px 0 6px;
  font-family: var(--font-body); font-size: 22px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--bill-text);
}
.bill-success-sub { font-size: 14.5px; color: var(--bill-muted); }
@keyframes bill-draw { to { stroke-dashoffset: 0; } }
@keyframes bill-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- entrega de la key + canje inmediato ---------- */

.bill-deliver {
  max-width: 560px; margin: 26px auto 0; text-align: left;
  opacity: 0; animation: bill-fade-up 0.5s ease-out 2.3s forwards;
}
.bill-deliver-block {
  padding: 18px; border-radius: 18px;
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}
.bill-deliver-block + .bill-deliver-block { margin-top: 12px; }
.bill-keybox {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 16px; border-radius: 14px;
  background: var(--bill-inner-strong);
  border: 1px solid rgba(255, 57, 71, 0.4);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.bill-keybox code {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-mono); font-size: 16px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--bill-text); overflow-wrap: anywhere; user-select: all;
}
.bill-copy-btn {
  flex-shrink: 0; min-height: 40px; min-width: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--bill-inner-border); background: var(--bill-inner);
  color: var(--bill-text); font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.bill-copy-btn:hover { border-color: var(--accent); }
.bill-copy-btn svg { width: 15px; height: 15px; }
.bill-copy-btn.is-copied { border-color: var(--success); color: var(--success); }
.bill-order-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--bill-muted-2); }
.bill-order-meta strong { color: var(--bill-muted); font-weight: 600; }
.bill-deliver h2 {
  font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--bill-text);
  margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
}
.bill-deliver h2 svg { width: 16px; height: 16px; color: var(--accent); }
.bill-redeem-form .field { margin-bottom: 12px; }
.bill-redeem-form select,
.bill-redeem-form input[type=text] { min-height: 44px; }
.bill-redeem-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 4px; }
.bill-redeem-actions .bill-pay-btn { flex: 1 1 220px; }
.bill-text-link { display: inline-flex; align-items: center; min-height: 40px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.bill-text-link:hover { text-decoration: underline; }
.bill-done { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--bill-text); }
.bill-done svg { width: 18px; height: 18px; color: var(--success); flex-shrink: 0; }

/* ---------- estados: procesando / lento / revision / fallido / vencido / reembolsado ---------- */

.bill-state {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 520px; margin: 0 auto; padding: 18px 0;
}
.bill-state-title {
  font-family: var(--font-body); font-size: 20px; font-weight: 700; letter-spacing: 0.01em;
  color: var(--bill-text); margin: 6px 0 0;
}
.bill-state-body { font-size: 14.5px; line-height: 1.55; color: var(--bill-muted); margin: 0; }
.bill-state-icon {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(255, 57, 71, 0.3);
}
.bill-state-icon svg { width: 26px; height: 26px; }
.bill-state-icon.is-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(255, 177, 59, 0.35); }
.bill-state-icon.is-muted { background: var(--bill-inner-strong); color: var(--bill-muted); border-color: var(--bill-inner-border); }
.bill-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.bill-state-actions .btn { min-height: 42px; }
.bill-progress {
  width: min(260px, 80%); height: 6px; border-radius: 9999px; overflow: hidden;
  background: var(--bill-inner-strong); border: 1px solid var(--bill-inner-border);
}
.bill-progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: var(--bill-red-grad);
  transition: width 0.3s ease;
}
.bill-order-chip {
  display: inline-block; max-width: 100%; text-align: center; line-height: 1.55;
  padding: 6px 14px; border-radius: 16px;
  font-size: 12.5px; color: var(--bill-muted);
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}
.bill-order-chip .mono { font-size: 11.5px; }

/* ==========================================================================
   /payments (admin, solo owner)
   ========================================================================== */

.bill-admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@container bill (min-width: 960px) {
  .bill-admin-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}
.bill-admin-grid > .wave-section { margin-bottom: 0; }

.bill-kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bill-kv li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px;
}
.bill-kv li:last-child { border-bottom: 0; }
.bill-kv-label { color: var(--bill-muted); min-width: 0; }
.bill-kv-label code { font-family: var(--font-mono); font-size: 11.5px; color: var(--bill-muted-2); }
html[data-theme="light"] .bill-kv li { border-bottom-color: #ece8e1; }

.bill-code {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 6px 6px 6px 14px; border-radius: 12px;
  background: var(--bill-inner-strong); border: 1px solid var(--bill-inner-border);
}
.bill-code code { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--bill-text); overflow-wrap: anywhere; }
.bill-events { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bill-event {
  font-family: var(--font-mono); font-size: 11.5px; padding: 4px 10px; border-radius: 9999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(255, 57, 71, 0.25);
  overflow-wrap: anywhere;
}
.bill-admin-steps { margin: 14px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--bill-muted); }
.bill-admin-steps li + li { margin-top: 4px; }
.bill-admin-steps code { font-family: var(--font-mono); font-size: 12px; color: var(--bill-text); }

/* KPI row: etiqueta en tinta secundaria, valor en tinta primaria (el color
   solo identifica, nunca pinta el numero). */
.bill-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bill-kpi {
  padding: 14px 16px; border-radius: 16px; min-width: 0;
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}
.bill-kpi-label { display: block; font-size: 12px; color: var(--bill-muted); }
.bill-kpi-value { display: block; margin-top: 4px; font-size: 22px; font-weight: 700; color: var(--bill-text); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.bill-kpi-foot { display: block; margin-top: 2px; font-size: 11.5px; color: var(--bill-muted-2); }
.bill-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bill-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 9999px; font-size: 12.5px;
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border); color: var(--bill-muted);
}
.bill-chip strong { color: var(--bill-text); font-weight: 700; }
.bill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bill-muted-2); flex-shrink: 0; }
.bill-dot.is-success { background: var(--success); }
.bill-dot.is-warning { background: var(--warning); }
.bill-dot.is-danger { background: var(--danger); }
.bill-dot.is-accent { background: var(--accent); }

.bill-settings-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin-bottom: 18px; }
.bill-toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.bill-toggle label { margin: 0; font-size: 14px; color: var(--bill-text); font-weight: 600; cursor: pointer; }
.bill-currency { min-width: 150px; }
.bill-currency select { min-height: 44px; }
.bill-price-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
@container bill (min-width: 760px) {
  .bill-price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bill-price-tier {
  margin: 0; min-width: 0; padding: 14px 16px 6px; border-radius: 16px;
  background: var(--bill-inner); border: 1px solid var(--bill-inner-border);
}
.bill-price-tier legend {
  padding: 0 6px; margin-left: -6px;
  font-size: 13px; font-weight: 700; color: var(--bill-text);
}
.bill-price-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.bill-price-fields .field { margin-bottom: 10px; min-width: 0; }
.bill-money { position: relative; }
.bill-money-cur {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--bill-muted-2);
  pointer-events: none;
}
.bill-money input[type=text] { padding-left: 50px; min-height: 42px; font-family: var(--font-mono); }
.bill-field-error input[type=text] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.bill-form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.bill-form-foot .btn { min-height: 42px; }
.bill-errors { margin: 0; padding-left: 18px; }
/* /legal-records: buscador del registro de aceptaciones */
.lgr-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lgr-search input[type=search] { flex: 1 1 220px; min-width: 0; min-height: 40px; }
.bill-inline-form { display: inline; margin: 0; }

/* ==========================================================================
   Telefono y tablet
   ========================================================================== */

@media (max-width: 640px) {
  .bill-glass {
    border-radius: 22px;
    /* blur pesado es caro en moviles: se reduce y se compensa con fondo mas opaco */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .bill-page { --bill-glass-bg: linear-gradient(160deg, rgba(34, 34, 38, 0.96) 0%, rgba(20, 20, 23, 0.97) 60%, rgba(14, 14, 16, 0.98) 100%); }
  html[data-theme="light"] .bill-page { --bill-glass-bg: #ffffff; }
  .bill-checkout { padding: 20px 16px; gap: 22px; }
  .bill-corner { width: 12px; height: 12px; }
  .bill-h { font-size: 25px; }
  .bill-sub { font-size: 14px; }
  .bill-steps { padding: 14px; gap: 14px; }
  .bill-lottie-wallet { width: 112px; height: 112px; margin: -8px auto -10px; }
  .bill-plan { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .bill-plan-tick { display: none; }
  .bill-plan-icon { width: 34px; height: 34px; border-radius: 10px; }
  .bill-plan-price { font-size: 16px; }
  .bill-period-btn { font-size: 12.5px; padding: 6px 6px; }
  .bill-lottie-swipe { flex-basis: 64px; width: 64px; height: 64px; margin: -8px 0; }
  .bill-total strong { font-size: 22px; }
  /* iOS hace zoom en campos con letra < 16px */
  .bill-page select,
  .bill-page input[type=text],
  .bill-page input[type=search],
  .bill-page input[type=email] { font-size: 16px; }

  .bill-stage { padding: 24px 14px 26px; }
  .bill-success-title { font-size: 18px; letter-spacing: 0.1em; }
  .bill-deliver-block { padding: 14px; }
  .bill-keybox { flex-wrap: wrap; padding: 10px; }
  .bill-keybox code { flex-basis: 100%; font-size: 15px; text-align: center; }
  .bill-keybox .bill-copy-btn { flex: 1 1 auto; }

  /* Tablas -> tarjetas apiladas (cada celda con su etiqueta). Prefijo
     .bill-page para ganarle en especificidad a las reglas genericas de
     tablas (min-width para scroll lateral, padding de celdas). */
  .bill-page .bill-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bill-page .table-wrap > .bill-table { min-width: 0; }
  .bill-page .bill-table,
  .bill-page .bill-table tbody,
  .bill-page .bill-table tr,
  .bill-page .bill-table td { display: block; width: 100%; }
  .bill-page .bill-table tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
  .bill-page .bill-table tbody tr:last-child { border-bottom: 0; }
  .bill-page .bill-table tbody tr:hover { background: transparent; }
  .bill-page .bill-table tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 5px 0; border: 0; text-align: right; min-width: 0;
  }
  .bill-page .bill-table td::before {
    content: attr(data-label);
    flex-shrink: 0; text-align: left;
    font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--bill-muted-2);
  }
  .bill-page .bill-table td > * { min-width: 0; }
  .bill-page .bill-table .bill-key-cell { justify-content: flex-end; }
  .bill-page .bill-table .btn { min-height: 40px; }
  .bill-page .bill-table .empty-row td { justify-content: center; }
  .bill-page .bill-table .empty-row td::before { content: none; }
  .bill-kpi-value { font-size: 19px; }
  .bill-form-foot .btn { width: 100%; }
}

@media (max-width: 380px) {
  .bill-lottie-swipe { display: none; }
  .bill-plan-icon { display: none; }
  .bill-plan { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ==========================================================================
   Movimiento reducido: sin vuelo de la tarjeta ni particulas; todo en su
   estado final desde el principio.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .bill-lcard-stage,
  .bill-lcard-left,
  .bill-lcard-right,
  .bill-lcard,
  .bill-lcard::after,
  .bill-success-msg,
  .bill-deliver,
  .bill-check-circle,
  .bill-check-path,
  .bill-particle { animation: none !important; }
  .bill-lcard-left { clip-path: none; }
  .bill-lcard-right { display: none; }
  .bill-lcard::after { opacity: 1; }
  .bill-success-msg, .bill-deliver { opacity: 1; }
  .bill-check-circle, .bill-check-path { stroke-dashoffset: 0; }
  .bill-particles { display: none; }
  .bill-lottie-success { transition: none; }
  .bill-spinner { animation-duration: 2.4s; }
  .bill-info, .bill-form, .bill-plan, .bill-pay-btn { transition: none; }
}
