/* ══════════════════════════════════════════════════════════════
   Mongo Product Affinity — Frontend CSS
   Badges de archivo · Panel de producto · Carrito
   ══════════════════════════════════════════════════════════════ */

:root {
    --mpa-brand:    var(--wd-primary-color);
    --mpa-brand-l:  #fdf0f5;
    --mpa-brand-m:  rgba(190,13,87,.12);
    --mpa-text:     #1a1a1a;
    --mpa-text-2:   #555;
    --mpa-text-3:   #999;
    --mpa-border:   #e8e8e8;
    --mpa-f:        'Outfit', system-ui, sans-serif;
    --mpa-radius:   8px;
}

/* ══ BADGE EN ARCHIVO DE PRODUCTOS ══════════════════════════════
 * Sutil, tipográfico, sin caja rellena. Solo visible con afinidad.
 * ══════════════════════════════════════════════════════════════ */

/* ── BADGE DE AFINIDAD EN ARCHIVO ──────────────────────────── */

.mpa-badge-wrap {
    display: inline-flex;
    align-items: center;
}

.mpa-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--mpa-f);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--wd-primary-color);
    background: var(--wd-primary-color-light, rgba(190, 13, 87, .07));
    border: none;
    border-radius: 5px;
    padding: 3px 8px;
    white-space: nowrap;
    line-height: 1;
    transition: background .2s;
    font-size: 0; /* ocultar texto inline antiguo */
}

.mpa-badge::after {
    font-size: 8.5px;
    font-weight: 700;
    content: 'Afín';
}

.mpa-badge:hover { background: var(--wd-primary-color-light, rgba(190, 13, 87, .1)); }

/* ≥95%: texto alternativo */
.mpa-badge--super .mpa-badge::after { content: 'Para ti'; }

/* ══ PANEL EN FICHA DE PRODUCTO ══════════════════════════════════
 * Sin caja, sin fondo de color. Solo una línea separadora y
 * tipografía limpia integrada con el resto de la ficha.
 * ══════════════════════════════════════════════════════════════ */

.mpa-panel-wrap {
    margin: 0 0 20px;
    font-family: var(--mpa-f);
}

/* Estado de carga: minimalista */
.mpa-panel-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 16px 0;
    border-top: 1px solid #e8e8e8;
}

/* ── Panel como card premium ────────────────────────────────
   Contenedor propio con borde neutro. Sin acentos de marca.
   ─────────────────────────────────────────────────────────── */
.mpa-panel {
    font-family: var(--mpa-f);
    padding: 0;
    border-top: none;
}

.mpa-panel--card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px 22px;
    background: #fff;
    margin-top: 8px;
}

/* Tiers: sin variantes de color — todo neutro */
.mpa-panel--card.mpa-panel--high,
.mpa-panel--card.mpa-panel--very-high,
.mpa-panel--card.mpa-panel--perfect {
    border-color: #e8e8e8;
}

/* Fila superior */
.mpa-panel__card-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.mpa-panel__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mpa-panel__label-pre {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #bbb;
    line-height: 1;
}

.mpa-panel__tier {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    color: #111;
    line-height: 1.05;
}

/* Sin cambio de color en ningún nivel */
.mpa-panel--very-high .mpa-panel__tier,
.mpa-panel--perfect   .mpa-panel__tier {
    color: #111;
}

.mpa-panel__score {
    display: flex;
    align-items: baseline;
    gap: 1px;
    flex-shrink: 0;
}

.mpa-panel__pct {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: -.05em;
    color: #111;
    line-height: 1;
}

.mpa-panel--very-high .mpa-panel__pct,
.mpa-panel--perfect   .mpa-panel__pct {
    color: #111;
}

.mpa-panel__pct-sym {
    font-size: 15px;
    font-weight: 600;
    color: #bbb;
    letter-spacing: 0;
    margin-bottom: 5px;
}

.mpa-panel--very-high .mpa-panel__pct-sym,
.mpa-panel--perfect   .mpa-panel__pct-sym {
    color: #bbb;
    opacity: 1;
}

/* Barra — única nota de color, muy fina */
.mpa-panel__bar-wrap { margin-bottom: 18px; }

.mpa-panel__bar-bg {
    height: 1px;
    background: #efefef;
    border-radius: 1px;
    overflow: hidden;
}

.mpa-panel__bar-fill {
    height: 100%;
    background: #111;
    border-radius: 1px;
    transition: width 1s cubic-bezier(.4, 0, .2, 1);
}

.mpa-panel--perfect .mpa-panel__bar-fill {
    background: #111;
}

/* Píldoras — monocromas, todas iguales */
.mpa-match-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 16px;
}

.mpa-match-pill {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 20px;
    background: transparent;
    border: 1px solid #d0d0d0;
    color: #444;
}

/* Sin colores por tipo — todas neutras */
.mpa-match-pill--skin,
.mpa-match-pill--concern,
.mpa-match-pill--texture,
.mpa-match-pill--age,
.mpa-match-pill--ingredient { background: transparent; color: #333; border: 1px solid #d4d4d4; }

/* Pill de aviso: tipo de piel incompatible — visualmente diferenciado de los matches positivos */
.mpa-match-pill--skin_mismatch {
    background: #fff8f0;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Pill de match parcial (edad adyacente) — ligeramente atenuada respecto al match exacto */
.mpa-match-pill--partial {
    opacity: .7;
    font-style: italic;
}

/* Descripción IA */
.mpa-panel__potencia-warning {
    margin: 8px 0 0;
    padding: 12px 16px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #92400e;
    background: #fff6f2;
    border-left: 3px solid #ffd0a9;
    line-height: 1.4;
}

/* Nota de concentración — antes de la descripción IA, en negrita, neutra */
.mpa-panel__potencia-note {
    font-size: 12px;
    color: #666;
    line-height: 1.45;
    margin: 0 0 10px;
    font-style: normal;
}
.mpa-panel__potencia-note strong {
    font-weight: 600;
    color: #555;
}

/* Variante warning: delta < 0 (piel sensible + activos intensos) */
.mpa-panel__potencia-note--warning {
    background: #fff6f2;
    border-left: 3px solid #ffd0a9;
    border-radius: 5px;
    padding: 10px 14px;
    color: #92400e;
}
.mpa-panel__potencia-note--warning strong {
    color: #78350f;
}

.mpa-panel__ai-desc { margin-top: 0; }

.mpa-panel__ai-text {
    font-size: 0.97rem;
    color: #444;
    line-height: 1.50;
    margin: 0 0 14px;
    font-weight: 300;
    font-style: normal;
}

/* Disclaimer — línea divisoria, sin fondo, diferenciado de la sección PRECAUCIÓN */
.mpa-panel__disclaimer {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    border-top: 1px solid #ebebeb;
    padding-top: 20px;
    margin: 20px 0 0;
    background: none;
    border-left: none;
    border-radius: 0;
    padding-left: 0;
}

.mpa-panel__disclaimer-icon {
    font-style: normal;
    font-size: 14px;
    color: #aaa;
    flex-shrink: 0;
    line-height: 1.5;
}

.mpa-panel__disclaimer p {
    font-size: 11px;
    color: #888;
    line-height: 1.55;
    margin: 0;
    font-style: normal;
}

.mpa-panel__disclaimer strong {
    color: #666;
    font-weight: 600;
}

.mpa-panel__ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
    color: #ccc;
    margin: 0;
    font-style: normal;
}

/* Sin perfil */
/* No-profile card — estilo similar a la card del escritorio */
.mpa-panel--no-profile {
    padding: 0;
    border-top: none;
}

.mpa-noprofile-card {
    border-width: 3px 1px 1px;
    border-style: solid;
    border-color: var(--wd-primary-color) #efefef #efefef;
    border-radius: 6px;
    padding: 18px 20px;
    background: #fff;
    box-sizing: border-box;
}

.mpa-noprofile-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mpa-noprofile-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #aaa;
}

.mpa-noprofile-card__badge {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--wd-primary-color);
    border: 1px solid var(--wd-primary-color);
    border-radius: 20px;
    padding: 1px 9px;
}

.mpa-noprofile-card__title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.2;
    margin: 0 0 6px;
}

.mpa-noprofile-card__desc {
    font-size: 0.8rem;
    color: #aaa;
    line-height: 1.5;
    margin: 0 0 14px;
}

.mpa-noprofile-card__link {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--wd-primary-color);
    text-transform: uppercase;
    letter-spacing: .04em;
    text-decoration: none;
}

.mpa-noprofile-card__link:hover {
    text-decoration: underline;
}

/* ══ CARRITO ════════════════════════════════════════════════════ */

.mpa-cart-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--wd-primary-color);
    background: transparent;
    border: 1px solid rgba(190, 13, 87, .28);
    border-radius: 2px;
    padding: 2px 7px;
    margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.mpa-cart-badge--sm {
    font-size: 9px;
    padding: 1px 6px;
    margin-left: 0;
}

/* ══ SPINNER ════════════════════════════════════════════════════ */

.mpa-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1.5px solid rgba(190, 13, 87, .2);
    border-top-color: var(--wd-primary-color);
    border-radius: 50%;
    animation: mpa-spin .7s linear infinite;
    flex-shrink: 0;
}

.mpa-spinner--sm {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
}

@keyframes mpa-spin { to { transform: rotate(360deg); } }

/* ══ NOTIFICACIÓN TOAST ═════════════════════════════════════════ */

.mpa-saved-notice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111;
    color: #fff;
    font-family: var(--mpa-f);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 10px 20px;
    border-radius: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    opacity: 0;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 99999;
    pointer-events: none;
}

.mpa-saved-notice--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ══ BADGE dentro de .product-loop-brand ═══════════════════════
 *
 * El JS mueve el .mpa-badge-wrap al interior de .product-loop-brand
 * y añade la clase .mpa-has-badge cuando hay afinidad suficiente.
 * Con flex + space-between, la marca queda a la izquierda
 * y el badge pegado a la derecha, sin tocar el h3 de título.
 * ═══════════════════════════════════════════════════════════════ */

/* Solo activo cuando el JS confirma afinidad y añade la clase */
.product-loop-brand.mpa-has-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Evitar que el nombre de marca se encoja si es largo */
.product-loop-brand.mpa-has-badge .wd-product-brands-links {
    flex: 1;
    min-width: 0;
}

/* Badge: no se encoge, alineado verticalmente al centro */
.product-loop-brand.mpa-has-badge .mpa-badge-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    align-self: center;
}

/* Tamaño ajustado a la tipografía de marca — sin override de font-size */
.product-loop-brand .mpa-badge {
    vertical-align: middle;
}

/* Aviso PRECAUCIÓN en descripción IA de producto */
.mpa-panel__ai-warning {
    font-size: 0.85rem;
    line-height: 1.40;
    margin: 8px 0 0;
    padding: 12px 16px;
    background: #fff6f2;
    border-left: 3px solid #ffd0a9;
    border-radius: 5px;
    color: #92400e;
    font-style: normal;
}

/* Disclaimer legal bajo la descripción IA */
/* mpa-panel__disclaimer — definido arriba */

/* ══ ANCHOR BADGE — Shortcode [mpa_affinity_anchor] ═════════════
 * Badge-enlace colocado bajo categorías en single product.
 * Intermedio en prominencia: más visible que el badge de archivo,
 * más sutil que el panel completo.
 * ══════════════════════════════════════════════════════════════ */

.mpa-anchor-wrap {
    margin: 10px 0;
    font-family: var(--mpa-f);
}

/* Anchor badge — premium, sin borde rosa
   Borde gris neutro, fondo muy suave, tipografía limpia */
.mpa-anchor-wrap .mpa-anchor-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: 7px 0 !important;
    background: #fff !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    color: #666 !important;
    transition: background .2s, color .2s;
    white-space: nowrap !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: none !important;
    width: auto !important;
    min-height: 32px !important;
}

.mpa-anchor-wrap .mpa-anchor-btn:hover {
    background: none !important;
    color: #444 !important;
}

/* Icono de afinidad */
.mpa-anchor-icon svg {
    width: 13px;
    height: 13px;
}

/* Cart badge SVG sizing */
.mpa-cart-badge svg,
.mpa-cart-badge--sm svg {
    width: 10px;
    height: 10px;
    vertical-align: middle;
}

/* Texto label */
.mpa-anchor-text {
    color: #aaa;
    font-size: 10px;
}

/* Separador tipográfico */
/* Tier */
.mpa-anchor-tier {
    color: #333;
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: 11px;
    text-transform: none;
}

/* Porcentaje */
.mpa-anchor-pct {
    color: #555;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -.02em;
    text-transform: none;
}

/* Flecha */
.mpa-anchor-arrow {
    color: #d0d0d0;
    font-size: 10px;
    line-height: 1;
    margin-left: 2px;
    transition: transform .2s, color .2s;
}

.mpa-anchor-wrap .mpa-anchor-btn:hover .mpa-anchor-arrow {
    color: #999;
    transform: translateY(2px);
}

/* Variantes de aviso — misma paleta gris neutral que el anchor estándar */
.mpa-anchor-wrap .mpa-anchor-btn--warning .mpa-anchor-text,
.mpa-anchor-wrap .mpa-anchor-btn--warning .mpa-anchor-arrow { color: #888 !important; }

.mpa-anchor-wrap .mpa-anchor-btn--caution .mpa-anchor-text,
.mpa-anchor-wrap .mpa-anchor-btn--caution .mpa-anchor-arrow { color: #888 !important; }

.mpa-anchor-wrap .mpa-anchor-btn--very-high,
.mpa-anchor-wrap .mpa-anchor-wrap .mpa-anchor-btn--perfect .mpa-anchor-tier {
    color: #222;
}

/* ══ PANEL DE INCOMPATIBILIDAD ══════════════════════════════════
 * Mismo sistema visual que el panel de afinidad.
 * Línea superior ámbar, icono ⚠, texto explicativo.
 * ══════════════════════════════════════════════════════════════ */

.mpa-panel--card.mpa-panel--card.mpa-panel--incompatible {
    border-top-color: #ffd0a9 !important;
    border-top-width: 2px !important;
}

.mpa-panel--incompatible .mpa-panel__label-pre {
    color: #d97706;
}

.mpa-panel--incompatible .mpa-panel__tier--warning {
    color: #92400e;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.mpa-panel__incomp-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    color: #d97706;
}

.mpa-panel__incomp-body {
    margin-top: 10px;
    margin-bottom: 4px;
}

.mpa-panel__incomp-body p {
    font-size: 0.97rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 6px;
    padding: 10px 14px;
    background: #fff6f2;
    border-left: 3px solid #ffd0a9;
    border-radius: 5px;
}

.mpa-panel__incomp-body p:last-child { margin-bottom: 0; }

.mpa-panel__incomp-body strong {
    color: #92400e;
    font-weight: 600;
}

/* ══ TOGGLE DE AFINIDAD ══════════════════════════════════════ */

.mpa-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mpa-f);
}

.mpa-toggle-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #555;
}

.mpa-toggle-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    box-shadow: none !important;
    min-height: unset !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
}

.mpa-toggle-track {
    display: block;
    width: 36px;
    height: 20px;
    background: #ddd;
    border-radius: 50px;
    position: relative;
    transition: background .2s;
}

.mpa-toggle-thumb {
    display: block;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: left .2s, background .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.mpa-toggle-btn[aria-checked="true"] .mpa-toggle-track {
    background: var(--wd-primary-color);
}

.mpa-toggle-btn[aria-checked="true"] .mpa-toggle-thumb {
    left: 19px;
}

/* Ocultar badges cuando toggle está OFF */
body.mpa-badges-hidden .mpa-badge-wrap {
    display: none !important;
}
body.mpa-badges-hidden .product-loop-brand.mpa-has-badge {
    display: revert !important;
    justify-content: revert !important;
}

/* Toggle en mi cuenta — layout horizontal con descripción */
.mpa-badge-pref-row {
    margin-top: 20px;
    padding: 16px 20px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
}

.mpa-badge-pref-row .mpa-toggle-wrap {
    width: 100%;
    justify-content: space-between;
    gap: 20px;
}

.mpa-badge-pref-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mpa-badge-pref-label {
    font-size: 13px;
    font-weight: 600;
    color: #222;
}

.mpa-badge-pref-hint {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* Ocultar paneles de afinidad en ficha de producto cuando toggle está OFF */
body.mpa-panels-hidden .mpa-panel-wrap,
/* El toggle de paneles oculta los paneles de producto pero NO el anchor shortcode
   que el tema puede colocar en cualquier posición (columna de precio, etc.) */
body.mpa-panels-hidden .mpa-affinity-panel-wrap .mpa-anchor-wrap {
    display: none !important;
}

/* ── Tipo de piel en reseñas — badge estilo afín ─────────── */
.mpa-review-skin-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--wd-primary-color);
    border: 1px solid var(--wd-primary-color);
    border-radius: 3px;
    padding: 2px 8px 2px 6px;
    line-height: 1.4;
    margin-bottom: 4px;
}

/* ── Widget productos para ti ─────────────────────────────── */
.mpa-products-for-you { margin: 0; }
.mpa-products-for-you__title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 20px;
}

/* ── Products for you: slider horizontal con igual altura ──────────────
   Usamos CSS Grid con grid-auto-flow:column en lugar de flex para que
   todos los items tengan exactamente la misma altura de fila — igual
   que el grid de WoodMart pero deslizable horizontalmente.           */
.mpa-products-for-you div.products,
.mpa-products-for-you ul.products {
    /* Sobreescribir el flex del shortcode PHP con grid */
    display: grid !important;
    grid-auto-flow: column !important;
    /* Ancho de cada columna = (100% - gaps) / columns */
    grid-auto-columns: calc((100% - (var(--mpa-pfy-cols, 4) - 1) * 20px) / var(--mpa-pfy-cols, 4)) !important;
    /* Scroll horizontal */
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 20px;
    padding-bottom: 16px;
    cursor: grab;
    /* Cancelar flex que pone WoodMart */
    flex-wrap: unset !important;
    flex-direction: unset !important;
    align-items: stretch;
}
.mpa-products-for-you div.products:active,
.mpa-products-for-you ul.products:active { cursor: grabbing; }

/* Scrollbar idéntica a WoodMart */
.mpa-products-for-you div.products::-webkit-scrollbar,
.mpa-products-for-you ul.products::-webkit-scrollbar { height: 5px; }
.mpa-products-for-you div.products::-webkit-scrollbar-track,
.mpa-products-for-you ul.products::-webkit-scrollbar-track { background: rgba(0,0,0,.07); border-radius: var(--wd-brd-radius, 5px); }
.mpa-products-for-you div.products::-webkit-scrollbar-thumb,
.mpa-products-for-you ul.products::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: var(--wd-brd-radius, 5px); }
.mpa-products-for-you div.products::-webkit-scrollbar-thumb:hover,
.mpa-products-for-you ul.products::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.3); }

/* Items: scroll snap + flex column para propagar altura */
.mpa-products-for-you .wd-product,
.mpa-products-for-you li.product {
    scroll-snap-align: start;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    /* flex interno para propagación de altura */
    display: flex !important;
    flex-direction: column !important;
}
/* Propagación de altura por la cadena interna */
.mpa-products-for-you .wd-product-wrapper,
.mpa-products-for-you .product-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.mpa-products-for-you .product-element-top { flex-shrink: 0; }
.mpa-products-for-you .product-element-bottom {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.mpa-products-for-you .price { margin-top: auto; }

/* Variables CSS para columnas responsivas (inyectadas desde PHP) */
@media (max-width: 1023px) {
    .mpa-products-for-you div.products,
    .mpa-products-for-you ul.products {
        grid-auto-columns: calc((100% - (var(--mpa-pfy-cols-tablet, 3) - 1) * 16px) / var(--mpa-pfy-cols-tablet, 3)) !important;
        gap: 16px;
    }
}
@media (max-width: 767px) {
    .mpa-products-for-you div.products,
    .mpa-products-for-you ul.products {
        grid-auto-columns: calc((100% - (var(--mpa-pfy-cols-mobile, 2) - 1) * 12px) / var(--mpa-pfy-cols-mobile, 2)) !important;
        gap: 12px;
    }
}

/* ── Rutina de skincare personalizada ─────────────────────── */
/* .mpa-routine — moved to mpa-account.css in v2.8.1 */

/* ── Alternativas recomendadas ────────────────────────────── */
.mpa-alternatives {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,.07);
}

.mpa-alternatives__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #16a34a;
    margin: 0 0 8px;
}

.mpa-alternatives__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mpa-alt-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
    padding: 4px 10px;
    border-radius: 20px;
    background: transparent;
    color: #333;
    border: 1px solid #d4d4d4;
    text-decoration: none;
    transition: border-color .15s, color .15s;
    line-height: 1.3;
}

a.mpa-alt-pill:hover {
    border-color: #999;
    color: #111;
    text-decoration: none;
}

/* ── Ingredient pills inside incompatibility / warning panels ── */
.mpa-panel__ingr-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
    padding: 3px 10px;
    border-radius: 20px;
    margin: 0 2px;
    vertical-align: middle;
    white-space: nowrap;
    background: transparent;
    border: 1px solid #d4d4d4;
    color: #333;
}

.mpa-panel__ingr-pill--bad {
    color: #78350f;
    border-color: #fcd34d;
}

.mpa-panel__ingr-pill--blocked {
    color: #7f1d1d;
    border-color: #fca5a5;
}

/* ── Enlace "Mi perfil de piel →" en la cabecera del panel ── */
/* Aparece como tercera línea bajo el tier label, discreta y bien integrada */
a.mpa-panel__mipiel-link.mpa-open-mipiel-popup {
    display: inline-block;
    margin-top: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--wd-primary-color, #be0d57);
    text-decoration: none;
    transition: opacity .15s;
    line-height: 1;
}
a.mpa-panel__mipiel-link.mpa-open-mipiel-popup:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    opacity: .85;
}

/* ═══════════════════════════════════════════════════════════════
   MPA DEBUG MODAL
   Bottom-sheet en móvil · modal centrado en escritorio
   Solo visible para administradores con debug mode activo
   ═══════════════════════════════════════════════════════════════ */

/* Botón trigger en el panel */
.mpa-debug-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 6px 12px;
    background: #1e1e2e;
    color: #a5b4fc;
    border: 1px solid #3730a3;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    opacity: .85;
    transition: opacity .15s, background .15s;
}
.mpa-debug-trigger:hover {
    opacity: 1;
    background: #2e2e45;
}

/* Body lock cuando el modal está abierto */
body.mpd-body-lock {
    overflow: hidden;
}

/* Overlay */
.mpd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    align-items: flex-end;
    justify-content: center;
}
.mpd-overlay--visible {
    display: flex;
}

/* Modal shell */
.mpd-modal {
    background: #0f0f1a;
    color: #e2e8f0;
    width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
    font-size: 13px;
    line-height: 1.5;
}
.mpd-modal--visible {
    transform: translateY(0);
}

/* Desktop: modal centrado */
@media (min-width: 768px) {
    .mpd-overlay {
        align-items: center;
    }
    .mpd-modal {
        width: min(860px, 94vw);
        max-height: 88vh;
        border-radius: 14px;
        transform: scale(.96) translateY(8px);
        opacity: 0;
        transition: transform .22s cubic-bezier(.32, .72, 0, 1), opacity .22s ease;
    }
    .mpd-modal--visible {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Header */
.mpd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px;
    border-bottom: 1px solid #1e1e35;
    flex-shrink: 0;
}
.mpd-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mpd-header__badge {
    background: #3730a3;
    color: #a5b4fc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, monospace;
}
.mpd-header__pid {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
}
.mpd-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.mpd-close:hover {
    color: #e2e8f0;
    background: #1e1e35;
}

/* Tabs */
.mpd-tabs-wrap {
    flex-shrink: 0;
    border-bottom: 1px solid #1e1e35;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mpd-tabs-wrap::-webkit-scrollbar { display: none; }
.mpd-tabs {
    display: flex;
    gap: 0;
    padding: 0 6px;
    white-space: nowrap;
}
.mpd-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.mpd-tab:hover {
    color: #a5b4fc;
}
.mpd-tab--active {
    color: #a5b4fc;
    border-bottom-color: #6366f1;
}

/* Panels */
.mpd-panels {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #2e2e45 transparent;
}
.mpd-panels::-webkit-scrollbar { width: 5px; }
.mpd-panels::-webkit-scrollbar-track { background: transparent; }
.mpd-panels::-webkit-scrollbar-thumb { background: #2e2e45; border-radius: 3px; }

.mpd-panel { display: none; padding: 16px 18px 24px; }
.mpd-panel--active { display: block; }

/* Loading / error */
.mpd-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    padding: 32px 20px;
    font-size: 13px;
}
.mpd-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #2e2e45;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: mpd-spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes mpd-spin { to { transform: rotate(360deg); } }
.mpd-error-msg {
    color: #fca5a5;
    background: #1c1c2e;
    border-left: 3px solid #ef4444;
    padding: 14px 16px;
    border-radius: 4px;
    margin: 16px 18px;
    font-size: 13px;
}

/* Score hero */
.mpd-score-hero {
    background: #13131f;
    border: 1px solid #1e1e35;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
    text-align: center;
}
.mpd-score-hero__pct {
    font-size: 44px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.03em;
}
.mpd-score-hero__raw {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}
.mpd-bar {
    height: 5px;
    background: #1e1e35;
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}
.mpd-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}

/* Table */
.mpd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.mpd-table tr + tr td {
    border-top: 1px solid #1a1a2e;
}
.mpd-table__section td {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #4a4a6a;
    padding: 14px 10px 5px;
    background: none;
    border-top: none !important;
}
.mpd-table__key {
    color: #94a3b8;
    padding: 7px 10px 7px 0;
    width: 48%;
    vertical-align: top;
}
.mpd-table__val {
    color: #e2e8f0;
    padding: 7px 0;
    vertical-align: top;
    word-break: break-word;
}
.mpd-code {
    background: #1e1e35;
    color: #a5b4fc;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}

/* Pills */
.mpd-pill {
    display: inline-block;
    background: #1e1e35;
    color: #a5b4fc;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    margin: 2px 2px 2px 0;
    font-weight: 500;
    border: 1px solid #2e2e55;
}
.mpd-pill--skin {
    background: #1a2e1a;
    color: #86efac;
    border-color: #166534;
}

/* Breakdown */
.mpd-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.mpd-brow {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #13131f;
}
.mpd-brow--miss {
    opacity: .45;
}
.mpd-brow__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.mpd-brow__text {
    flex: 1;
    min-width: 0;
}
.mpd-brow__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    word-break: break-word;
}
.mpd-brow__detail {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
    word-break: break-word;
}
.mpd-brow__note {
    display: block;
    font-size: 11px;
    color: #4a6fa5;
    font-style: italic;
    margin-top: 1px;
}
.mpd-brow__delta {
    font-size: 12px;
    font-weight: 700;
    font-family: 'SFMono-Regular', Consolas, monospace;
    flex-shrink: 0;
    padding-left: 8px;
    text-align: right;
    min-width: 70px;
}
.mpd-total {
    margin-top: 14px;
    padding: 10px 14px;
    background: #13131f;
    border: 1px solid #1e1e35;
    border-radius: 8px;
    font-size: 13px;
    color: #94a3b8;
}
.mpd-total strong {
    color: #e2e8f0;
}

/* Prompt */
.mpd-prompt-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mpd-prompt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.mpd-prompt-meta {
    font-size: 11px;
    color: #4a4a6a;
    font-family: 'SFMono-Regular', Consolas, monospace;
}
.mpd-copy-btn {
    background: #1e1e35;
    border: 1px solid #2e2e55;
    color: #a5b4fc;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.mpd-copy-btn:hover {
    background: #2e2e55;
}
.mpd-prompt {
    background: #13131f;
    border: 1px solid #1e1e35;
    border-radius: 8px;
    color: #94a3b8;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 11px;
    line-height: 1.65;
    padding: 14px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    margin: 0;
    max-height: 55vh;
    overflow-y: auto;
}

/* Fix scroll vertical en tabs del debug modal.
   .mpd-body es el div contenedor donde el JS inyecta el HTML.
   Sin display:flex + min-height:0 en la cadena flex, el overflow-y
   del .mpd-panels no tiene altura acotada y no puede hacer scroll. */
.mpd-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.mpd-modal {
    min-height: 0;
}
.mpd-panels {
    min-height: 0;
}
