
/* NUJIZ UNIFIED PDF PREVIEW V567 */

/* Repair ancestor overflow only when active. */

html body .np567-overflow {

    overflow:visible!important;
    overflow-x:visible!important;
    overflow-y:visible!important;
}

html body .pdf-workspace .np567-active {

    overflow:visible!important;

    min-width:0!important;

    align-items:start!important;
}

html body .pdf-workspace
.np567-active > .np567-preview {

    position:sticky!important;

    top:var(--np567-top,90px)!important;

    bottom:auto!important;

    align-self:start!important;

    min-width:0!important;

    min-height:0!important;

    height:auto!important;

    max-height:calc(
        100dvh - var(--np567-top,90px) - 20px
    )!important;

    overflow:auto!important;

    overscroll-behavior:contain;

    z-index:25!important;

    scrollbar-width:thin;

    border-radius:12px!important;
}

/* Independent preview header */

html body .pdf-workspace .np567-head {

    display:flex!important;

    position:sticky!important;

    top:0!important;

    z-index:35!important;

    align-items:center!important;

    justify-content:space-between!important;

    flex-wrap:wrap!important;

    gap:8px!important;

    padding:8px 10px!important;

    background:#171b24!important;

    color:#ffffff!important;

    border-bottom:1px solid #465166!important;

    box-sizing:border-box!important;
}

html body .pdf-workspace .np567-collapse {

    display:inline-flex!important;

    align-items:center!important;

    justify-content:center!important;

    min-height:32px!important;

    padding:5px 10px!important;

    border:1px solid #8b5cf6!important;

    border-radius:8px!important;

    background:#30234e!important;

    color:#ffffff!important;

    -webkit-text-fill-color:#ffffff!important;

    font-size:12px!important;

    font-weight:700!important;

    cursor:pointer;
}

html body .pdf-workspace
.np567-collapsed > .np567-preview {

    height:auto!important;

    min-height:0!important;

    max-height:none!important;
}

html body .pdf-workspace
.np567-collapsed > .np567-preview
> :not(.np567-head) {

    display:none!important;
}

/* Shared workspace: preserve its own collapse button */

html body .pdf-workspace
.np567-active.np567-shared
> .npw-preview-head {

    position:sticky!important;

    top:var(--np567-top,90px)!important;

    z-index:28!important;
}

html body .pdf-workspace
.np567-active.np567-shared
> .np567-preview {

    top:calc(
        var(--np567-top,90px) + 54px
    )!important;

    max-height:calc(
        100dvh - var(--np567-top,90px) - 80px
    )!important;
}

html body .pdf-workspace
.np567-active.npw-collapsed
> .np567-preview {

    display:none!important;
}

/* Mobile */

@media(max-width:800px) {

    html body .pdf-workspace
    .np567-active:not(.np567-shared) {

        display:flex!important;

        flex-direction:column!important;

        align-items:stretch!important;

        gap:12px!important;
    }

    html body .pdf-workspace
    .np567-active > .np567-preview {

        order:-19!important;

        position:sticky!important;

        top:var(--np567-top,75px)!important;

        align-self:stretch!important;

        width:100%!important;

        min-width:0!important;

        min-height:0!important;

        max-height:36dvh!important;

        overflow:auto!important;

        z-index:35!important;

        background:var(--nsw-bg,#171b24)!important;

        box-shadow:0 8px 22px #00000040;

        box-sizing:border-box!important;
    }

    html body .pdf-workspace
    .np567-active.np567-shared
    > .npw-preview-head {

        order:-20!important;

        position:sticky!important;

        top:var(--np567-top,75px)!important;

        z-index:36!important;
    }

    html body .pdf-workspace
    .np567-active.np567-shared
    > .np567-preview {

        top:calc(
            var(--np567-top,75px) + 54px
        )!important;

        max-height:30dvh!important;
    }

    html body .pdf-workspace
    .np567-active > .np567-controls {

        position:relative!important;

        top:auto!important;

        width:100%!important;

        min-width:0!important;

        min-height:0!important;

        max-height:none!important;

        overflow:visible!important;

        box-sizing:border-box!important;
    }

    html body .pdf-workspace
    .np567-active:not(.np567-shared)
    > .np567-controls {

        order:1!important;
    }

    html body .pdf-workspace
    .np567-collapsed > .np567-preview {

        max-height:none!important;
    }

    html body .pdf-workspace
    .np567-active.npw-collapsed
    > .np567-preview {

        display:none!important;
    }

    html body .pdf-workspace
    .np567-active input,

    html body .pdf-workspace
    .np567-active select {

        scroll-margin-top:calc(
            var(--np567-top,75px) + 36dvh + 20px
        );
    }
}

/* Short landscape screens */

@media(max-width:800px) and (orientation:landscape) {

    html body .pdf-workspace
    .np567-active > .np567-preview {

        max-height:26dvh!important;
    }

    html body .pdf-workspace
    .np567-active.np567-shared
    > .np567-preview {

        max-height:22dvh!important;
    }
}
