.shared-media-library-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 14, 42, 0.52);
    z-index: 1400;
}
.shared-media-library-modal.is-open {
    display: flex;
}
.shared-media-library-dialog {
    width: min(1120px, 100%);
    height: min(880px, calc(100vh - 48px));
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(79, 23, 168, 0.16);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,248,255,0.98));
    box-shadow: 0 28px 72px rgba(20, 14, 42, 0.28);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}
.shared-media-library-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(79, 23, 168, 0.10);
    background: rgba(79, 23, 168, 0.04);
}
.shared-media-library-close {
    min-width: 42px;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(79, 23, 168, 0.12);
    background: rgba(255,255,255,0.88);
    color: var(--primary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.shared-media-library-toolbar {
    padding: 16px 22px;
    border-bottom: 1px solid rgba(79, 23, 168, 0.10);
    display: grid;
    gap: 12px;
    background: rgba(255,255,255,0.92);
}
.shared-media-library-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.shared-media-library-tab {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(79, 23, 168, 0.14);
    background: rgba(255,255,255,0.78);
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
}
.shared-media-library-tab.is-active {
    background: rgba(79, 23, 168, 0.12);
    border-color: rgba(79, 23, 168, 0.26);
    box-shadow: inset 0 0 0 1px rgba(79, 23, 168, 0.04);
}
.shared-media-library-pane[hidden] {
    display: none !important;
}
.shared-media-library-browser {
    min-height: 0;
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.shared-media-library-browser-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.shared-media-library-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 148px));
    gap: 14px;
    justify-content: start;
    align-content: start;
    flex: 0 0 auto;
}
.shared-media-library-grid-footer {
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
}
.shared-media-library-card {
    border: 1px solid rgba(79, 23, 168, 0.12);
    border-radius: 18px;
    background: rgba(255,255,255,0.94);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    width: 100%;
}
.shared-media-library-card:hover,
.shared-media-library-card:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(79, 23, 168, 0.24);
    box-shadow: 0 18px 34px rgba(79, 23, 168, 0.10);
    outline: none;
}
.shared-media-library-card.is-active {
    border-color: rgba(79, 23, 168, 0.30);
    box-shadow: 0 18px 34px rgba(79, 23, 168, 0.12);
}
.shared-media-library-card-media {
    position: relative;
    overflow: hidden;
    background: rgba(79, 23, 168, 0.04);
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0;
    line-height: 0;
    display: block;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
.shared-media-library-card-label {
    padding: 10px 12px 12px;
    display: grid;
    gap: 4px;
}
.shared-media-library-card-label strong {
    display: block;
    font-size: 0.96rem;
    line-height: 1.25;
}
.shared-media-library-card-label .small {
    line-height: 1.35;
}
.shared-media-library-card-media.is-folder {
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(79,23,168,0.10), rgba(79,23,168,0.03));
    color: var(--primary);
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
}
.shared-media-library-empty {
    padding: 18px;
    border: 1px dashed rgba(79, 23, 168, 0.18);
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
    background: rgba(79, 23, 168, 0.02);
}
.shared-media-library-detail-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(18, 9, 44, 0.42);
    z-index: 1500;
}
.shared-media-library-detail-modal.is-open {
    display: flex;
}
.shared-media-library-detail-dialog {
    width: min(1120px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 360px);
    background: rgba(255,255,255,0.98);
    border-radius: 28px;
    border: 1px solid rgba(79, 23, 168, 0.14);
    box-shadow: 0 36px 80px rgba(33, 14, 77, 0.22);
}
.shared-media-library-detail-preview {
    padding: 24px;
    background: linear-gradient(180deg, rgba(79,23,168,0.04) 0%, rgba(79,23,168,0.02) 100%);
    display: grid;
    gap: 16px;
    align-content: start;
    min-height: 0;
    overflow: auto;
}
.shared-media-library-detail-frame {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(79, 23, 168, 0.10);
    background: #fff;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shared-media-library-detail-frame img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 68vh;
    object-fit: contain;
    background: #fff;
}
.shared-media-library-detail-frame.is-non-image {
    color: var(--muted);
    padding: 36px;
    text-align: center;
}
.shared-media-library-detail-side {
    padding: 24px;
    border-left: 1px solid rgba(79, 23, 168, 0.10);
    display: grid;
    gap: 18px;
    align-content: start;
    min-height: 0;
    overflow: auto;
}
.shared-media-library-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.shared-media-library-detail-title {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.15;
}
.shared-media-library-detail-close {
    min-width: 42px;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(79, 23, 168, 0.12);
    background: rgba(255,255,255,0.88);
    color: var(--primary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.shared-media-library-detail-meta {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(79, 23, 168, 0.04);
    border: 1px solid rgba(79, 23, 168, 0.10);
}
.shared-media-library-detail-meta-row {
    display: grid;
    gap: 4px;
}
.shared-media-library-detail-meta-row strong {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.shared-media-library-detail-actions {
    display: grid;
    gap: 10px;
}
.shared-media-library-detail-link {
    word-break: break-all;
}
@media (max-width: 980px) {
    .shared-media-library-browser {
        padding-inline: 16px;
    }
    .shared-media-library-grid {
        grid-template-columns: repeat(4, minmax(0, 132px));
    }
    .shared-media-library-detail-dialog {
        grid-template-columns: 1fr;
    }
    .shared-media-library-detail-side {
        border-left: 0;
        border-top: 1px solid rgba(79, 23, 168, 0.10);
    }
}
@media (max-width: 760px) {
    .shared-media-library-grid {
        grid-template-columns: repeat(3, minmax(0, 112px));
        gap: 12px;
    }
}
