.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-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) {
    .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;
    }
}

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

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