.ui-dialog.aeo-document-dialog {
    width: min(56rem, calc(100vw - 2rem)) !important;
    max-width: calc(100vw - 2rem) !important;
}

.ui-dialog.aeo-document-dialog .ui-dialog-content {
    max-height: calc(100vh - 7rem) !important;
    padding: 0.8rem !important;
    overflow: auto !important;
}

.ui-dialog.aeo-document-dialog .ui-scrollpanel {
    width: 100% !important;
    height: auto !important;
    border: 0 !important;
}

.ui-dialog.aeo-document-dialog .ui-scrollpanel-container,
.ui-dialog.aeo-document-dialog .ui-scrollpanel-content {
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
}

.aeo-document-reader {
    --reader-navy: #0c4a6e;
    --reader-teal: #08765f;
    --reader-border: #d7e3ea;
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--reader-border);
    border-radius: 1rem;
    background: #f3f7f9;
    color: #17384c;
    box-shadow: 0 14px 34px rgba(15, 55, 76, 0.12);
}

.aeo-document-reader-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(6.5rem, auto) 1fr minmax(6.5rem, auto);
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--reader-border);
    background: rgba(255, 255, 255, 0.97);
}

.aeo-document-reader-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid #b9ccd7;
    border-radius: 0.7rem;
    background: #ffffff;
    color: var(--reader-navy);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.aeo-document-reader-nav:hover:not(:disabled),
.aeo-document-reader-nav:focus-visible {
    border-color: var(--reader-teal);
    background: #eaf7f4;
    color: #075b4a;
}

.aeo-document-reader-nav:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.aeo-document-reader-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.aeo-document-reader-counter strong {
    min-width: 2rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #e6f3f0;
    color: #086350;
    text-align: center;
}

.aeo-document-reader-viewport {
    min-height: min(38rem, 70vh);
    padding: 0.85rem;
}

.aeo-document-reader-page {
    display: none;
    width: 100%;
    margin: 0;
}

.aeo-document-reader-page.is-active {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.aeo-document-reader-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.8rem;
    border-radius: 0.7rem;
    background: var(--reader-navy);
    color: #ffffff;
}

.aeo-document-reader-caption span {
    padding: 0.18rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.aeo-document-reader-canvas {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: min(32rem, 60vh);
    overflow: auto;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #dfe8ed;
}

.aeo-document-reader-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 62vh;
    object-fit: contain;
    border-radius: 0.3rem;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 47, 65, 0.16);
}

.aeo-document-reader-surface,
.aeo-document-reader-image-frame {
    display: contents;
}

/* Keep zoomable previews in an internally scrolling document surface. */
.aeo-document-reader--zoom {
    display: flex;
    flex-direction: column;
    height: min(48rem, calc(100vh - 9rem));
    height: min(48rem, calc(100dvh - 9rem));
    min-height: 0;
    box-sizing: border-box;
}

.aeo-document-reader--zoom .aeo-document-reader-toolbar,
.aeo-document-reader--zoom .aeo-document-reader-caption,
.aeo-document-reader--zoom .aeo-document-reader-pages {
    flex: none;
}

.aeo-document-reader-tools {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.aeo-document-reader-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid #b9ccd7;
    border-radius: 0.6rem;
    background: #ffffff;
    color: var(--reader-navy);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.aeo-document-reader-tool[aria-pressed="true"],
.aeo-document-reader-tool:hover:not(:disabled) {
    border-color: var(--reader-teal);
    background: #eaf7f4;
    color: #075b4a;
}

.aeo-document-reader-tool:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.aeo-document-reader-tool:focus-visible,
.aeo-document-reader--zoom .aeo-document-reader-canvas:focus-visible {
    outline: 3px solid #08765f;
    outline-offset: -3px;
}

.aeo-document-reader-scale {
    min-width: 3.5rem;
    color: var(--reader-navy);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.aeo-document-reader--zoom .aeo-document-reader-viewport {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.aeo-document-reader--zoom .aeo-document-reader-page.is-active {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.aeo-document-reader--zoom .aeo-document-reader-canvas {
    display: block;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 0;
    direction: ltr;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    touch-action: pan-x pan-y pinch-zoom;
}

.aeo-document-reader--zoom .aeo-document-reader-surface {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    padding: 0.75rem;
    box-sizing: border-box;
}

.aeo-document-reader--zoom .aeo-document-reader-image {
    position: absolute;
    top: 50%;
    left: 50%;
    flex: none;
    max-width: none;
    max-height: none;
    user-select: none;
}

.aeo-document-reader--zoom .aeo-document-reader-image-frame {
    display: block;
    position: relative;
    flex: none;
}

.aeo-document-reader--zoom .aeo-document-reader-canvas.is-pannable {
    cursor: grab;
}

.aeo-document-reader--zoom .aeo-document-reader-canvas.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.aeo-document-reader--zoom .aeo-document-reader-pages {
    max-height: 5.5rem;
    overflow: auto;
}

/* Keep the document preview centered as its content loads, even on a scrolled page. */
body .ui-dialog.aeo-document-dialog.aeo-document-dialog--zoom,
body.employee-portal-page .ui-dialog.aeo-document-dialog.aeo-document-dialog--zoom {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: 94vw !important;
    max-width: calc(100vw - 2rem) !important;
    height: 92vh !important;
    height: 92dvh !important;
    max-height: calc(100vh - 2rem) !important;
    max-height: calc(100dvh - 2rem) !important;
    flex-direction: column;
    margin: 0 !important;
    overflow: hidden;
    transform: translate(-50%, -50%) !important;
}

.ui-dialog.aeo-document-dialog--zoom .ui-dialog-titlebar {
    flex: none;
}

.ui-dialog.aeo-document-dialog.aeo-document-dialog--zoom .ui-dialog-content {
    flex: 1;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

.ui-dialog.aeo-document-dialog--zoom .aeo-document-reader-shell,
.ui-dialog.aeo-document-dialog--zoom .aeo-document-reader-host,
.ui-dialog.aeo-document-dialog--zoom .aeo-document-reader--zoom {
    height: 100%;
}

body .ui-dialog.aeo-document-dialog.aeo-document-dialog--expanded,
body.employee-portal-page .ui-dialog.aeo-document-dialog.aeo-document-dialog--expanded {
    position: fixed !important;
    top: 0.5rem !important;
    left: 0.5rem !important;
    display: flex !important;
    flex-direction: column;
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    height: calc(100vh - 1rem) !important;
    height: calc(100dvh - 1rem) !important;
    max-height: calc(100vh - 1rem) !important;
    max-height: calc(100dvh - 1rem) !important;
    margin: 0 !important;
    transform: none !important;
}

.ui-dialog.aeo-document-dialog.aeo-document-dialog--expanded .ui-dialog-titlebar {
    flex: none;
}

.ui-dialog.aeo-document-dialog.aeo-document-dialog--expanded .ui-dialog-content {
    flex: 1;
    min-height: 0;
    max-height: none !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

.aeo-document-dialog--expanded .aeo-document-reader-shell,
.aeo-document-dialog--expanded .aeo-document-reader-host,
.aeo-document-dialog--expanded .aeo-document-reader--zoom {
    height: 100%;
}

.aeo-document-reader-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid var(--reader-border);
    background: #ffffff;
}

.aeo-document-reader-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid #aabfc9;
    border-radius: 50%;
    background: #ffffff;
    color: #31566a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.aeo-document-reader-page-button.is-active,
.aeo-document-reader-page-button:hover,
.aeo-document-reader-page-button:focus-visible {
    border-color: var(--reader-teal);
    background: var(--reader-teal);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(8, 118, 95, 0.16);
}

.aeo-document-reader-empty {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    min-height: 15rem;
    padding: 2.5rem 1rem;
    color: #567080;
    text-align: center;
}

.aeo-document-reader-empty .pi {
    font-size: 2.5rem;
    color: #7693a3;
}

@media (max-width: 600px) {
    body .ui-dialog.aeo-document-dialog.aeo-document-dialog--zoom,
    body.employee-portal-page .ui-dialog.aeo-document-dialog.aeo-document-dialog--zoom {
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
        height: calc(100vh - 1rem) !important;
        height: calc(100dvh - 1rem) !important;
        max-height: calc(100vh - 1rem) !important;
        max-height: calc(100dvh - 1rem) !important;
    }

    .ui-dialog.aeo-document-dialog {
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
    }

    .ui-dialog.aeo-document-dialog .ui-dialog-content {
        max-height: calc(100vh - 5.5rem) !important;
        padding: 0.45rem !important;
    }

    .aeo-document-reader-toolbar {
        grid-template-columns: 1fr auto 1fr;
        gap: 0.4rem;
        padding: 0.55rem;
    }

    .aeo-document-reader-nav {
        min-width: 0;
        padding-inline: 0.6rem;
    }

    .aeo-document-reader-nav span {
        display: none;
    }

    .aeo-document-reader-viewport {
        min-height: 55vh;
        padding: 0.5rem;
    }

    .aeo-document-reader-canvas {
        min-height: 48vh;
        padding: 0.4rem;
    }

    .aeo-document-reader--zoom {
        height: calc(100vh - 7rem);
        height: calc(100dvh - 7rem);
    }

    .aeo-document-reader-tool {
        padding-inline: 0.5rem;
        font-size: 0.8rem;
    }

    .aeo-document-reader-expand span {
        display: none;
    }
}

@media (max-height: 600px) {
    .ui-dialog.aeo-document-dialog--zoom .ui-dialog-content {
        max-height: calc(100vh - 5rem) !important;
        max-height: calc(100dvh - 5rem) !important;
        padding: 0.4rem !important;
    }

    .aeo-document-reader--zoom {
        height: calc(100vh - 6rem);
        height: calc(100dvh - 6rem);
    }

    .aeo-document-reader--zoom .aeo-document-reader-toolbar {
        gap: 0.35rem;
        padding: 0.4rem;
    }

    .aeo-document-reader--zoom .aeo-document-reader-tools {
        flex-wrap: nowrap;
        justify-content: flex-start;
        min-width: 0;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .aeo-document-reader-tools > * {
        flex: none;
    }

    .aeo-document-reader--zoom .aeo-document-reader-nav,
    .aeo-document-reader-tool {
        min-height: 2.25rem;
        padding-block: 0.25rem;
        font-size: 0.78rem;
    }

    .aeo-document-reader--zoom .aeo-document-reader-caption,
    .aeo-document-reader--zoom .aeo-document-reader-pages {
        padding: 0.35rem 0.6rem;
    }

    .aeo-document-reader--zoom .aeo-document-reader-viewport {
        padding: 0.45rem;
    }

    .aeo-document-reader--zoom .aeo-document-reader-page.is-active {
        gap: 0.35rem;
    }
}

@media print {
    .aeo-document-reader-toolbar,
    .aeo-document-reader-pages {
        display: none !important;
    }

    .aeo-document-reader-page {
        display: flex !important;
        break-after: page;
    }

    .aeo-document-reader--zoom,
    .aeo-document-reader--zoom .aeo-document-reader-viewport,
    .aeo-document-reader--zoom .aeo-document-reader-canvas {
        display: block;
        height: auto;
        overflow: visible;
    }

    .aeo-document-reader--zoom .aeo-document-reader-surface {
        width: auto;
        min-height: 0;
    }

    .aeo-document-reader--zoom .aeo-document-reader-image {
        position: static;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        max-width: 100%;
    }

    .aeo-document-reader--zoom .aeo-document-reader-image-frame {
        display: contents;
    }
}
