/* ============================================================
   CCG MANUAL VIEWER — NATIVE TOP-LAYER PDF DIALOG
   showModal() places the PDF outside transformed/contained page
   wrappers so it always opens in the user's current viewport.
============================================================ */

/* Legacy manual modal remains in generated page markup for compatibility,
   but the dedicated top-layer dialog is now the only active manual viewer. */
#manualModal.ccg-modal--doc {
    display: none !important;
}

.ccg-manual-dialog {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #f6fbff;
    overflow: hidden;
}

.ccg-manual-dialog:not([open]) {
    display: none;
}

.ccg-manual-dialog[open] {
    display: block;
}

.ccg-manual-dialog::backdrop {
    background: rgba(2, 5, 12, 0.94);
    backdrop-filter: blur(8px);
}

.ccg-manual-dialog__content {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #f3f5f7;
}

.ccg-manual-dialog__toolbar {
    position: relative;
    flex: 0 0 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 64px 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background: #0c1324;
    color: #f6fbff;
}

.ccg-manual-dialog__label {
    flex: 0 0 auto;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ccg-manual-dialog__hint {
    min-width: 0;
    color: rgba(246, 251, 255, 0.72);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ccg-manual-dialog__close {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    color: #ffffff;
    font: inherit;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 1;
    text-shadow: none;
}

.ccg-manual-dialog__close:hover,
.ccg-manual-dialog__close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.48);
    outline: 2px solid rgba(255, 255, 255, 0.72);
    outline-offset: 2px;
}

.ccg-manual-dialog__status {
    position: absolute;
    z-index: 3;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(12, 19, 36, 0.92);
    color: #f6fbff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ccg-manual-dialog__status[hidden] {
    display: none !important;
}

.ccg-manual-dialog__frame {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    min-height: 0;
    max-width: none;
    margin: 0;
    border: 0;
    background: #f3f5f7;
    overscroll-behavior: contain;
}

@media (max-width: 700px) {
    .ccg-manual-dialog__toolbar {
        flex-basis: 52px;
        min-height: 52px;
        padding: 7px 58px 7px 12px;
    }

    .ccg-manual-dialog__hint {
        display: none;
    }

    .ccg-manual-dialog__close {
        top: 6px;
        right: 8px;
        width: 38px;
        height: 38px;
        min-height: 38px;
    }

    .ccg-manual-dialog__status {
        top: 62px;
        max-width: calc(100vw - 24px);
        white-space: normal;
        text-align: center;
    }

    .ccg-manual-dialog__frame {
        height: calc(100vh - 52px);
        height: calc(100dvh - 52px);
    }
}
