.posts-shell {
    width: min(1540px, calc(100% - 48px));
}

.posts-intro {
    max-width: 860px;
}

.posts-status {
    margin: -10px 0 22px;
    color: var(--muted);
    font-size: 14px;
}

.posts-status.is-error {
    padding: 15px 18px;
    border: 1px solid rgba(255, 154, 170, .5);
    border-radius: 14px;
    background: rgba(255, 154, 170, .08);
    color: var(--danger);
}

.posts-workspace {
    display: grid;
    grid-template-columns: 230px minmax(480px, 1fr) minmax(330px, 390px);
    gap: 22px;
    align-items: start;
}

.series-panel,
.slides-panel,
.post-preview-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(33, 22, 47, .88);
    box-shadow: 0 25px 70px rgba(0, 0, 0, .2);
}

.series-panel {
    padding: 21px 14px 16px;
}

.panel-heading {
    padding: 0 8px 14px;
}

.panel-heading h2,
.selected-series-heading h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -.025em;
}

.series-list {
    display: grid;
    gap: 7px;
}

.series-button {
    width: 100%;
    padding: 12px 11px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}

.series-button:hover {
    transform: translateX(2px);
    color: white;
}

.series-button.is-selected {
    border-color: rgba(255, 92, 140, .45);
    background: rgba(255, 92, 140, .13);
    color: white;
}

.series-button small {
    display: block;
    margin-bottom: 4px;
    color: var(--pink);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.series-button strong {
    display: block;
    font-size: 13px;
    line-height: 1.32;
}

.slides-panel {
    padding: 24px;
}

.selected-series-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.series-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: #160f21;
    color: var(--pink-soft);
    font-size: 11px;
    font-weight: 900;
}

.plan-card {
    margin-bottom: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(22, 15, 33, .74);
}

.plan-card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 17px;
    cursor: pointer;
    list-style: none;
}

.plan-card > summary::-webkit-details-marker {
    display: none;
}

.plan-card > summary strong {
    display: block;
    font-size: 16px;
}

.plan-card > summary .eyebrow {
    margin-bottom: 4px;
    font-size: 9px;
}

.plan-summary {
    flex: 0 0 auto;
    max-width: 48%;
    padding: 6px 9px;
    border-radius: 999px;
    background: #251831;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.plan-card[open] .plan-summary {
    color: white;
}

.plan-form {
    display: grid;
    gap: 15px;
    padding: 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.plan-grid {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 13px;
}

.plan-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 88px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    outline: none;
    background: #160f21;
    color: var(--text);
    font: inherit;
    line-height: 1.5;
}

.plan-form textarea:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(255, 92, 140, .13);
}

.channel-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin: 0;
    padding: 0;
    border: 0;
}

.channel-options legend {
    width: 100%;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.channel-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.channel-options input {
    width: 18px;
    height: 18px;
    accent-color: var(--pink);
}

.plan-actions {
    display: grid;
    grid-template-columns: minmax(160px, .55fr) 1fr;
    align-items: center;
    gap: 14px;
}

.plan-save {
    margin-top: 0;
}

.local-note {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.local-note.is-saved {
    color: #b8f6dd;
}

.slides-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.slide-button {
    position: relative;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 17px;
    background: #160f21;
    color: white;
    text-align: left;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.slide-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 36px rgba(0, 0, 0, .22);
}

.slide-button.is-selected {
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(255, 92, 140, .12), 0 15px 36px rgba(0, 0, 0, .22);
}

.slide-button img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #0d0813;
}

.slide-caption {
    display: grid;
    gap: 3px;
    padding: 11px 12px 12px;
}

.slide-caption small {
    color: var(--pink);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.slide-caption strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-preview-panel {
    position: sticky;
    top: 18px;
    padding: 20px;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #160f21;
    color: white;
    font-size: 22px;
}

.icon-button:hover:not(:disabled) {
    border-color: var(--pink);
}

.post-preview-frame {
    position: relative;
    display: block;
    width: min(100%, 350px);
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border: 0;
    border-radius: 18px;
    background: #0d0813;
    box-shadow: 0 20px 54px rgba(0, 0, 0, .32);
}

.post-preview-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.post-preview-frame .preview-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 25px;
    color: var(--muted);
}

.post-preview-frame.is-ready .preview-placeholder {
    display: none;
}

.preview-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 13px;
}

.compact-button {
    min-height: 42px;
    padding: 0 11px;
    font-size: 12px;
}

.preview-copy {
    display: grid;
    gap: 10px;
    padding: 18px 2px 5px;
}

.preview-copy h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.preview-copy p {
    margin: 0;
}

#preview-body {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.52;
}

.preview-cta {
    color: var(--pink-soft);
    font-size: 13px;
    font-weight: 900;
}

.source-label {
    display: block;
    margin: 5px 0 6px;
    color: #8f8297;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.preview-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 9px;
}

.preview-sources a {
    color: var(--pink-soft);
    font-size: 11px;
    line-height: 1.35;
    text-decoration: none;
}

.preview-sources a:hover {
    color: white;
    text-decoration: underline;
}

.download-slide {
    display: grid;
    place-items: center;
    text-decoration: none;
}

.image-dialog {
    width: min(96vw, 1100px);
    max-width: none;
    max-height: 96vh;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #100b1d;
    color: white;
    box-shadow: 0 35px 100px rgba(0, 0, 0, .72);
}

.image-dialog::backdrop {
    background: rgba(7, 4, 12, .88);
    backdrop-filter: blur(8px);
}

.dialog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 1px 1px 12px 8px;
    color: var(--pink-soft);
    font-size: 12px;
    font-weight: 900;
}

.dialog-stage {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    align-items: center;
    gap: 14px;
}

.dialog-stage img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: calc(96vh - 90px);
    margin: 0 auto;
    border-radius: 14px;
    background: #0d0813;
}

.dialog-arrow {
    width: 52px;
    height: 72px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #1d1429;
    color: white;
    font-size: 24px;
}

.dialog-arrow:hover:not(:disabled) {
    border-color: var(--pink);
    background: #2a1c3b;
}

@media (max-width: 1180px) {
    .posts-workspace {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .post-preview-panel {
        position: static;
        grid-column: 1 / -1;
    }

    .post-preview-frame {
        width: min(100%, 470px);
    }
}

@media (max-width: 760px) {
    .posts-shell {
        width: min(100% - 28px, 1540px);
    }

    .posts-workspace {
        grid-template-columns: 1fr;
    }

    .series-panel,
    .slides-panel,
    .post-preview-panel {
        border-radius: 19px;
    }

    .series-panel {
        padding: 16px;
    }

    .series-list {
        display: flex;
        gap: 9px;
        padding: 2px 1px 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    .series-button {
        flex: 0 0 175px;
        min-height: 76px;
        scroll-snap-align: start;
    }

    .series-button:hover {
        transform: none;
    }

    .slides-panel {
        padding: 18px;
    }

    .plan-grid,
    .plan-actions {
        grid-template-columns: 1fr;
    }

    .plan-actions {
        gap: 9px;
    }

    .post-preview-panel {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .slides-list {
        gap: 9px;
    }

    .slide-caption {
        padding: 9px;
    }

    .slide-caption strong {
        font-size: 10px;
    }

    .plan-card > summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .plan-summary {
        max-width: 100%;
    }

    .dialog-stage {
        position: relative;
        display: block;
    }

    .dialog-arrow {
        position: absolute;
        z-index: 2;
        top: 50%;
        width: 40px;
        height: 58px;
        transform: translateY(-50%);
        background: rgba(29, 20, 41, .9);
    }

    #dialog-previous-button { left: 6px; }
    #dialog-next-button { right: 6px; }

    .dialog-stage img {
        width: 100%;
    }
}
