/* Membresía Nexo — planes unificados (activación + cambiar plan + registro) */

#tab-saas.is-choose-plan .saas-renewal,
#tab-saas.is-choose-plan .saas-membership,
#tab-saas.is-choose-plan .pay-hero,
#tab-saas.is-choose-plan .clear-steps,
#tab-saas.is-choose-plan .saas-paid-success,
#tab-saas .clear-steps,
#tab-saas .pay-hero,
#tab-saas #pay-card-soon,
#tab-saas .pay-card-box,
#tab-saas #pay-card-soon[hidden],
#tab-saas .pay-card-box[hidden],
#tab-saas .legal-accept-box {
  display: none !important;
}
#tab-saas.is-card-member #membership-plans {
  display: none !important;
}
#tab-saas.is-card-member #pay-card-soon:not([hidden]) {
  display: flex !important;
  max-width: 380px;
  margin: 16px auto;
}

/* —— Tokens —— */
.mpg,
.mpg-switch,
#rc-plans.mpg {
  --mp-ink: #243447;
  --mp-muted: #6a7f94;
  --mp-line: #e2eaf2;
  --mp-paper: #ffffff;
  --mp-wash: #f7fafc;
  --mp-accent: #0EA5E9;
  --mp-accent-soft: #E0F2FE;
  --mp-accent-deep: #0369A1;
  --mp-shadow: 0 2px 6px rgba(26, 35, 50, 0.04), 0 12px 32px rgba(36, 88, 181, 0.07);
  --mp-shadow-featured: 0 4px 12px rgba(26, 35, 50, 0.06), 0 20px 48px rgba(14, 165, 233, 0.14);
  margin: 0 auto 28px;
  max-width: 1120px;
  padding: 0 4px;
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
  color: var(--mp-ink);
}

.mpg-stage {
  position: relative;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mpg-head {
  text-align: center;
  margin: 0 auto 36px;
  max-width: 38rem;
}

/* Contenedor centrado de las 3 tarjetas */
.mpg-grid-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

#tab-saas .pay-layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 24px) calc(24px + env(safe-area-inset-bottom, 0px));
}
#tab-saas .saas-membership {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.mpg-head .mpg-eyebrow,
.mpg-head .mpg-kicker {
  display: block;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mp-accent);
}
.mpg-head h2 {
  margin: 0 0 10px;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: clamp(1.65rem, 2.8vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--mp-ink);
}
.mpg-head p {
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.55;
  color: var(--mp-muted);
  font-weight: 500;
}
.mpg-head p strong {
  color: var(--mp-ink);
  font-weight: 700;
}

.mpg-cycle {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 28px;
  padding: 4px;
  max-width: 360px;
  background: var(--mp-paper);
  border: 1px solid var(--mp-line);
  border-radius: 999px;
  box-shadow: var(--mp-shadow);
}
.mpg-cycle-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--mp-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mpg-cycle-btn span {
  display: block;
  font-size: 10px;
  font-weight: 550;
  margin-top: 2px;
  opacity: 0.85;
}
.mpg-cycle-btn.is-on {
  background: var(--mp-ink);
  color: #fff;
}

/* —— Grid: tarjetas premium centradas —— */
.mpg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
  align-items: stretch;
  justify-items: stretch;
  width: 100%;
}

.mpg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 460px;
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 32px rgba(15, 23, 42, 0.07);
  color: var(--mp-ink);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.mpg-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.mpg-card::before {
  content: "";
  display: block;
  height: 5px;
  background: #e5e7eb;
}
.mpg-card.is-featured::before {
  background: linear-gradient(90deg, #0EA5E9, #7DD3FC, #2458b5);
  height: 6px;
}
.mpg-card.is-current-plan::before,
.mpg-card.is-selected::before {
  background: #0EA5E9;
}
.mpg-card:hover:not(.is-current-plan) {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(36, 52, 71, 0.08);
}
.mpg-card.is-featured {
  border-color: rgba(14, 165, 233, 0.32);
  box-shadow:
    0 12px 36px rgba(14, 165, 233, 0.12),
    0 0 0 1px rgba(14, 165, 233, 0.06);
  transform: none;
  z-index: 2;
}
.mpg-card.is-selected,
.mpg-card.is-current-plan {
  border-color: rgba(14, 165, 233, 0.32);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.1);
}
.mpg-card.is-current-plan:hover,
.mpg-card.is-featured:hover {
  transform: translateY(-2px);
}

.mpg-card-top {
  padding: 22px 24px 0;
  min-height: 48px;
  text-align: center;
}
.mpg-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 4px 24px 26px;
  min-height: 0;
  text-align: center;
}

.mpg-badge {
  display: inline-flex;
  align-self: center;
  margin: 0 auto;
  min-height: 28px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--mp-accent-soft);
  color: var(--mp-accent-deep);
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.08);
}
.mpg-badge--gold {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}
.mpg-badge--ghost {
  visibility: hidden;
  background: transparent;
  box-shadow: none;
}
.mpg-card.is-current-plan .mpg-badge {
  background: #eef2f7;
  color: #1a3f8a;
}

.mpg-name {
  margin: 0 0 6px;
  font-size: clamp(1.2rem, 2.2vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--mp-ink);
  line-height: 1.2;
}
.mpg-tagline {
  margin: 0 auto 16px;
  max-width: 16rem;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--mp-muted);
  min-height: 2.6em;
  font-weight: 500;
}

.mpg-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--mp-line);
}
.mpg-price strong {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--mp-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mpg-price span {
  font-size: 13px;
  color: var(--mp-muted);
  font-weight: 600;
}

/* Bloque de prorrateo / diferencia al subir */
.mpg-proration {
  display: grid;
  gap: 4px;
  margin: 0 0 18px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  text-align: center;
  line-height: 1.35;
}
.mpg-proration-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mpg-proration-amt {
  font-size: clamp(1.35rem, 3vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.mpg-proration-detail,
.mpg-proration-next {
  font-size: 12px;
  font-weight: 600;
}
.mpg-proration--current {
  background: #f3f4f6;
  color: #6b7280;
  font-size: 13px;
  font-weight: 650;
}
.mpg-proration--upgrade {
  background: linear-gradient(180deg, #eef2f7 0%, #f8fafc 100%);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: #1a3f8a;
}
.mpg-proration--upgrade .mpg-proration-label { color: #0369A1; }
.mpg-proration--upgrade .mpg-proration-amt { color: #1a3f8a; }
.mpg-proration--upgrade .mpg-proration-detail { color: #0369A1; }
.mpg-proration--upgrade .mpg-proration-next { color: #4a7ec9; }
.mpg-proration--down {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
}
.mpg-proration--down .mpg-proration-label { color: #475569; }

.mpg-setup {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--mp-accent-deep);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.mpg-feat {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  flex: 1 1 auto;
  text-align: left;
}
.mpg-feat li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  font-size: 13px;
  line-height: 1.45;
  color: #374151;
  font-weight: 500;
  border-top: 1px solid #f3f4f6;
}
.mpg-feat li:first-child {
  border-top: 0;
  padding-top: 0;
}
.mpg-feat-check {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--mp-accent);
  font-size: 11px;
  font-weight: 800;
  margin-top: 1px;
}
.mpg-feat li span:last-child {
  flex: 1;
  min-width: 0;
}

.mpg-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}
.mpg-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mpg-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.mpg-btn:disabled {
  opacity: 1;
  cursor: default;
}
.mpg-btn:not(.mpg-btn-primary):not(.is-current) {
  background: var(--mp-paper);
  color: var(--mp-ink);
  box-shadow: inset 0 0 0 1.5px var(--mp-line);
}
.mpg-btn:not(.mpg-btn-primary):not(.is-current):hover:not(:disabled) {
  background: var(--mp-wash);
}
.mpg-btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.22) inset, 0 8px 20px rgba(37, 99, 235, 0.28);
}
.mpg-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #0369a1 100%);
}
.mpg-card.is-featured .mpg-btn-primary {
  min-height: 52px;
  font-size: 15px;
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.25);
}
.mpg-btn-outline {
  background: var(--mp-paper) !important;
  color: var(--mp-ink) !important;
  box-shadow: inset 0 0 0 1.5px var(--mp-line) !important;
}
.mpg-btn-outline:hover:not(:disabled) {
  background: var(--mp-wash) !important;
}
.mpg-btn.is-current,
.mpg-btn-primary:disabled {
  background: #f3f4f6 !important;
  color: #9ca3af !important;
  box-shadow: inset 0 0 0 1.5px #e5e7eb !important;
}

.mpg-legal {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--mp-muted);
  text-align: center;
  font-weight: 500;
}
.mpg-legal a {
  color: var(--mp-ink);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mpg-note {
  margin: 24px auto 0;
  max-width: 32rem;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--mp-muted);
  font-weight: 500;
}

.mpg-switch {
  margin: 24px 0 0;
  max-width: none;
}
.mpg-switch .mpg-stage {
  padding: 0;
}

/* Panel miembro activo — resumen compacto blanco */
.saas-membership {
  margin: 0 0 0;
  padding: 0;
  border: 1px solid #e5e7eb !important;
  border-radius: 18px;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
.saas-membership.is-active,
.saas-membership.is-ok {
  border-left: 4px solid #2458b5 !important;
  background: #fff !important;
}
.saas-membership.is-warn {
  border-left: 4px solid #f59e0b !important;
  background: #fff !important;
}
.saas-renewal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f3f4f6;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.saas-membership .saas-renewal-badge {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2458b5;
}
.saas-membership.is-warn .saas-renewal-badge { color: #b45309; }
.saas-membership .saas-renewal-head > strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111827;
  line-height: 1.25;
}
.saas-membership-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #f3f4f6;
}
.saas-membership-grid > div {
  padding: 18px 20px;
  border-right: 1px solid #f3f4f6;
}
.saas-membership-grid > div:last-child { border-right: 0; }
.saas-membership-grid .muted {
  display: block;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af !important;
  margin-bottom: 6px !important;
}
.saas-membership-grid strong {
  display: block;
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #111827;
  letter-spacing: -0.02em;
}
.saas-membership .saas-renewal-policy {
  padding: 16px 24px 18px;
  margin: 0 !important;
  font-size: 13.5px;
  line-height: 1.5;
  color: #6b7280;
}
.saas-membership .saas-access-box,
.saas-membership .saas-cancel-box {
  margin: 0;
  border: 0;
  border-top: 1px solid #f3f4f6;
  border-radius: 0;
  background: #fafbfc;
}
.saas-membership .saas-access-box summary,
.saas-membership .saas-cancel-box summary {
  padding: 14px 24px;
}

/* Zona de planes — centrada y premium */
.saas-plans-root {
  margin: 28px auto 0;
  padding: clamp(24px, 4vw, 44px) clamp(16px, 3vw, 36px) clamp(28px, 4vw, 48px);
  width: 100%;
  max-width: 1120px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(14, 165, 233, 0.07) 0%, transparent 55%),
    linear-gradient(165deg, #f8fafc 0%, #eef2f7 48%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: clamp(18px, 3vw, 28px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.saas-plans-root[hidden] { display: none !important; }
#tab-saas.is-choose-plan #saas-plans-root {
  display: none !important;
}

.saas-paid-success {
  margin: 0 auto 24px;
  max-width: 520px;
  padding: 28px 24px;
  border: 1px solid rgba(14, 165, 233, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, #eef2f7 0%, #f8fafc 100%);
  text-align: center;
  color: var(--mp-ink);
}
.saas-paid-success[hidden] { display: none !important; }
.saas-paid-success-badge {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mp-accent-deep);
}
.saas-paid-success strong {
  display: block;
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.saas-paid-success p {
  margin: 0 auto 16px;
  max-width: 28rem;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--mp-muted);
}
.saas-paid-success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.saas-access-box {
  margin: 16px 0 0;
  border: 1px solid var(--mp-line);
  border-radius: 12px;
  background: var(--mp-wash);
  overflow: hidden;
}
.saas-access-box summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 700;
}
.saas-access-box summary::-webkit-details-marker { display: none; }
.saas-access-list {
  list-style: none;
  margin: 0;
  padding: 0 18px 14px;
  display: grid;
  gap: 6px;
}
.saas-access-list li { font-size: 13px; }
.saas-access-list li.is-on { color: #15803d; }
.saas-access-list li.is-off { color: #9ca3af; }

/* Primera activación: pantalla limpia */
#tab-saas.is-choose-plan .page-head {
  text-align: center;
  max-width: 1120px;
  margin: 0 auto;
  padding-bottom: 8px !important;
}
#tab-saas.is-choose-plan .page-head h1 {
  font-size: clamp(1.5rem, 2.5vw, 1.85rem) !important;
  font-weight: 800 !important;
}
#tab-saas.is-choose-plan .page-head .lede {
  margin: 0 auto;
  max-width: 32rem;
}
#tab-saas.is-choose-plan .pay-layout {
  max-width: 1120px;
  margin: 0 auto;
}

#tab-saas .nv-board-head h1 {
  font-family: "Outfit", system-ui, sans-serif !important;
  letter-spacing: -0.03em;
}

/* Modal tarjeta MP */
.mp-brick-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 18px 14px;
}
.mp-brick-modal[hidden] { display: none !important; }
.mp-brick-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  cursor: pointer;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(6px);
}
.mp-brick-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(92vh, 760px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--mp-line);
  background: var(--mp-paper);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.mp-brick-chrome {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--mp-line);
}
.mp-brick-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mp-accent);
  margin-bottom: 6px;
}
.mp-brick-head strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--mp-ink);
}
.mp-brick-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--mp-muted);
}
.mp-brick-x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--mp-wash);
  color: var(--mp-ink);
  font-size: 22px;
  cursor: pointer;
}
.mp-brick-body { padding: 8px 14px 6px; }
.mp-brick-actions { padding: 8px 16px 16px; }
.mp-brick-actions .btn { width: 100%; border-radius: 12px; }
body.mp-brick-open { overflow: hidden; }

@media (max-width: 960px) {
  .mpg-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 420px;
    margin: 0 auto;
  }
  .mpg-card {
    max-width: none;
    min-height: auto;
  }
  .mpg-card.is-featured {
    order: -1;
    transform: none;
  }
  .mpg-card.is-featured:hover {
    transform: translateY(-3px);
  }
  .saas-membership-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .saas-membership-grid > div:nth-child(2n) { border-right: 0; }
  .saas-membership-grid > div:nth-child(-n+2) { border-bottom: 1px solid #f3f4f6; }
  .saas-plans-root {
    padding: 24px 14px 28px;
    border-radius: 18px;
    margin-top: 20px;
  }
  .mpg-head {
    margin-bottom: 24px;
    padding: 0 4px;
  }
  .mpg-head p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  #tab-saas .pay-layout {
    padding-left: 10px;
    padding-right: 10px;
  }
  .mpg-card-body {
    padding-left: 18px;
    padding-right: 18px;
  }
  .mpg-card-top {
    padding-left: 18px;
    padding-right: 18px;
  }
  .mpg-btn {
    min-height: 52px;
    font-size: 15px;
  }
  .mpg-proration {
    padding: 12px;
  }
}

/* Legibilidad en panel comerciante */
body.shell-admin .mpg {
  font-size: 16px;
}
body.shell-admin .mpg-head .mpg-kicker {
  font-size: 14px !important;
  letter-spacing: 0.06em !important;
}
body.shell-admin .mpg-head p {
  font-size: 17px !important;
  line-height: 1.6 !important;
  color: #334155 !important;
}
body.shell-admin .mpg-cycle-btn {
  font-size: 15px !important;
  min-height: 48px !important;
}
body.shell-admin .mpg-cycle-btn span {
  font-size: 12px !important;
}
body.shell-admin .mpg-feat li,
body.shell-admin .mpg-card-desc,
body.shell-admin .saas-access-list li {
  font-size: 15px !important;
  line-height: 1.55 !important;
}
body.shell-admin .mpg-btn {
  font-size: 16px !important;
  min-height: 52px !important;
}
body.shell-admin .mpg-price-val {
  font-size: clamp(2rem, 5vw, 2.5rem) !important;
}
