/*
 * Nuevo producto en telefono.
 * Esta hoja queda deliberadamente fuera de tablet y escritorio.
 */
@media (max-width: 539px) {
    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-divisa-chips {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        box-sizing: border-box !important;
        width: 100% !important;
        min-height: 44px !important;
        gap: 3px !important;
        padding: 3px !important;
        overflow: hidden !important;
        border: 1px solid #d7dee8 !important;
        border-radius: 10px !important;
        background: #f4f6fa !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 36px !important;
        min-height: 36px !important;
        margin: 0 !important;
        padding: 0 5px !important;
        gap: 5px !important;
        overflow: hidden !important;
        border: 1px solid transparent !important;
        border-radius: 8px !important;
        background: transparent !important;
        color: #8792a7 !important;
        box-shadow: none !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency :is(.pv-moneda-switch-icono, .pv-moneda-switch-track) {
        display: none !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch-label {
        display: inline !important;
        min-width: 0 !important;
        color: #8792a7 !important;
        font-size: 10px !important;
        font-weight: 850 !important;
        line-height: 1 !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch::after {
        content: none !important;
        display: none !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch.active,
    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch:has(input:checked) {
        border-color: #ded7f8 !important;
        background: #fff !important;
        color: #6844df !important;
        box-shadow: 0 3px 9px rgba(85, 61, 166, 0.12) !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch.active .pv-moneda-switch-label,
    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch:has(input:checked) .pv-moneda-switch-label {
        color: #6844df !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch.active::after,
    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-currency .pv-moneda-switch:has(input:checked)::after {
        content: "\2713" !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 14px !important;
        width: 14px !important;
        height: 14px !important;
        border-radius: 50% !important;
        background: #eee9ff !important;
        color: #6844df !important;
        font-size: 9px !important;
        font-weight: 950 !important;
        line-height: 1 !important;
    }

    html body #pvf-shell #pv-modal-producto-inv .noalyx-mobile-product-error {
        box-sizing: border-box !important;
        width: 100% !important;
        margin: 0 0 10px !important;
        padding: 9px 11px !important;
        border: 1px solid #f2c9d5 !important;
        border-radius: 10px !important;
        background: #fff4f7 !important;
        color: #a61745 !important;
        font-size: 10.5px !important;
        font-weight: 750 !important;
        line-height: 1.35 !important;
    }

    html body #pvf-shell #pv-modal-producto-inv .rv-producto-field.noalyx-mobile-product-invalid > :is(input, .pv-cs) {
        outline: 2px solid rgba(220, 38, 94, 0.26) !important;
        outline-offset: 2px !important;
    }

    /* El servidor devuelve el motivo exacto cuando no puede crear el
       producto (por ejemplo, una foto inválida). En teléfono ese aviso vivía
       al inicio de un formulario largo y quedaba fuera de la vista después
       de tocar Crear producto. Se conserva dentro del pie fijo y junto a la
       acción que lo produjo. */
    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-form-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr) !important;
        grid-template-areas:
            "product-error product-error"
            "product-cancel product-create" !important;
        gap: 7px !important;
    }

    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-form-actions > .noalyx-mobile-product-submit-error {
        grid-area: product-error !important;
        box-sizing: border-box !important;
        width: 100% !important;
        min-width: 0 !important;
        max-height: 74px !important;
        margin: 0 !important;
        padding: 8px 10px !important;
        overflow: auto !important;
        border: 1px solid #f2c9d5 !important;
        border-radius: 10px !important;
        background: #fff4f7 !important;
        color: #a61745 !important;
        font-size: 10.5px !important;
        font-weight: 750 !important;
        line-height: 1.32 !important;
        text-align: left !important;
    }

    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-form-actions > .noalyx-mobile-product-submit-error[hidden] {
        display: none !important;
    }

    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-form-actions > .rv-producto-cancel {
        grid-area: product-cancel !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-form-actions > .rv-producto-create {
        grid-area: product-create !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    html body #pvf-shell #pv-modal-producto-rapido .rv-producto-image.noalyx-mobile-product-invalid {
        border-radius: 10px !important;
        outline: 2px solid rgba(220, 38, 94, 0.26) !important;
        outline-offset: 3px !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-image .pv-producto-upload-preview.has-image {
        grid-template-columns: 48px minmax(0, 1fr) 68px !important;
        grid-template-areas: "preview-image preview-copy preview-remove" !important;
        align-items: center !important;
        column-gap: 8px !important;
        box-sizing: border-box !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 6px !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-image .pv-producto-upload-preview.has-image > img {
        grid-area: preview-image !important;
        width: 48px !important;
        height: 42px !important;
        margin: 0 !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-image .pv-producto-upload-preview.has-image > span {
        grid-area: preview-copy !important;
        min-width: 0 !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-image .pv-producto-upload-preview.has-image > .pv-producto-upload-remove {
        grid-area: preview-remove !important;
        align-self: center !important;
        justify-self: end !important;
        display: inline-flex !important;
        width: 68px !important;
        min-width: 68px !important;
        height: 36px !important;
        min-height: 36px !important;
        margin: 0 !important;
        padding: 0 9px !important;
        gap: 5px !important;
        white-space: nowrap !important;
    }

    html body #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido) .rv-producto-image .pv-producto-upload-preview.has-image > .pv-producto-upload-remove > span {
        display: inline !important;
        min-width: 0 !important;
        color: inherit !important;
        font-size: 9.5px !important;
        font-weight: 800 !important;
        line-height: 1 !important;
    }

    /* El alta de almacén puede abrirse desde el selector del modal de
       producto. En móvil, producto usa una capa extrema y dejaba el segundo
       modal detrás aunque estuviera activo. Se promueve solamente mientras
       está visible y se evita que el backdrop inferior forme otra capa GPU. */
    html body #pvf-shell #pv-modal-nuevo-almacen:not([hidden]) {
        z-index: 2147483600 !important;
        isolation: isolate !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        will-change: transform !important;
    }

    html body:has(#pv-modal-nuevo-almacen:not([hidden])) #pvf-shell :is(#pv-modal-producto-inv, #pv-modal-producto-rapido):not([hidden]) {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
}
