.fund-structure-viewer {
    --viewer-blue: #003c83;
    --viewer-blue-bright: #0878d1;
    --viewer-ink: #17324d;
    --viewer-muted: #6b7f93;
    position: relative;
    overflow: hidden;
    width: 100%;
    border: 1px solid rgba(0, 60, 131, .14);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(18, 54, 88, .14);
}

.fund-structure-viewer [hidden] {
    display: none !important;
}

.fund-structure-viewer__header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 88px;
    padding: 16px 20px;
    color: #fff;
    background:
        radial-gradient(circle at 82% -60%, rgba(91, 190, 255, .75), transparent 38%),
        linear-gradient(120deg, #00356f 0%, #0057a8 58%, #0878d1 100%);
}

.fund-structure-viewer__header::after {
    position: absolute;
    right: 28%;
    bottom: -55px;
    width: 180px;
    height: 110px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    content: '';
    pointer-events: none;
}

.fund-structure-viewer__identity {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.fund-structure-viewer__identity > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.fund-structure-viewer__identity strong {
    overflow: hidden;
    font-size: clamp(16px, 2vw, 21px);
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fund-structure-viewer__identity small {
    margin-top: 4px;
    overflow: hidden;
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fund-structure-viewer__mark {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
    font-size: 20px;
    backdrop-filter: blur(10px);
}

.fund-structure-viewer__tools,
.fund-structure-viewer__zoom-group {
    display: flex;
    align-items: center;
}

.fund-structure-viewer__tools {
    position: relative;
    z-index: 1;
    gap: 10px;
    flex: 0 0 auto;
}

.fund-structure-viewer__page-count {
    min-width: 78px;
    color: rgba(255, 255, 255, .8);
    font-size: 12px;
    text-align: right;
}

.fund-structure-viewer__zoom-group {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 12px;
    background: rgba(9, 36, 65, .28);
    backdrop-filter: blur(10px);
}

.fund-structure-viewer__tools button {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 0;
    color: #fff;
    background: transparent;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, opacity .2s ease;
}

.fund-structure-viewer__tools button:hover,
.fund-structure-viewer__tools button:focus-visible {
    background: rgba(255, 255, 255, .18);
    outline: none;
}

.fund-structure-viewer__tools button:active {
    transform: scale(.94);
}

.fund-structure-viewer__tools button:disabled {
    cursor: not-allowed;
    opacity: .4;
}

.fund-structure-viewer__tools .fund-structure-viewer__zoom-value {
    width: 64px;
    border-right: 1px solid rgba(255, 255, 255, .16);
    border-left: 1px solid rgba(255, 255, 255, .16);
    font-size: 12px;
    font-weight: 700;
}

.fund-structure-viewer__fullscreen {
    border: 1px solid rgba(255, 255, 255, .24) !important;
    border-radius: 12px;
    background: rgba(9, 36, 65, .28) !important;
    backdrop-filter: blur(10px);
}

.fund-structure-viewer__stage {
    position: relative;
    min-height: 680px;
    max-height: min(78vh, 900px);
    overflow: auto;
    padding: 28px;
    background-color: #edf2f7;
    background-image:
        linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px),
        radial-gradient(circle at 50% 0, rgba(0, 99, 183, .08), transparent 42%);
    background-size: 24px 24px, 24px 24px, 100% 100%;
    scrollbar-color: rgba(51, 91, 126, .45) transparent;
    scrollbar-width: thin;
}

.fund-structure-viewer__stage::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.fund-structure-viewer__stage::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(51, 91, 126, .45);
    background-clip: padding-box;
}

.fund-structure-viewer__pages {
    display: flex;
    min-width: min-content;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.fund-structure-viewer__page {
    overflow: hidden;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 38px rgba(24, 52, 80, .2), 0 0 0 1px rgba(41, 73, 103, .08);
}

.fund-structure-viewer__page canvas {
    display: block;
    background: #fff;
}

.fund-structure-viewer__loading,
.fund-structure-viewer__error {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--viewer-muted);
    font-size: 14px;
}

.fund-structure-viewer__error {
    color: #a52a35;
}

.fund-structure-viewer__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0, 87, 168, .16);
    border-top-color: var(--viewer-blue-bright);
    border-radius: 50%;
    animation: fund-structure-spin .8s linear infinite;
}

.fund-structure-viewer:fullscreen {
    display: flex;
    border: 0;
    border-radius: 0;
    flex-direction: column;
    background: #edf2f7;
}

.fund-structure-viewer:fullscreen .fund-structure-viewer__stage {
    min-height: 0;
    max-height: none;
    flex: 1;
}

@keyframes fund-structure-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
    .fund-structure-viewer {
        border-radius: 14px;
    }

    .fund-structure-viewer__header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 14px;
    }

    .fund-structure-viewer__tools {
        justify-content: space-between;
    }

    .fund-structure-viewer__page-count {
        min-width: 0;
        margin-right: auto;
        text-align: left;
    }

    .fund-structure-viewer__stage {
        min-height: 500px;
        padding: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fund-structure-viewer__tools button {
        transition: none;
    }

    .fund-structure-viewer__spinner {
        animation-duration: 1.8s;
    }
}
