.dashboard-shell {
    width: min(2100px, calc(100% - 24px));
    margin: 6px auto 0;
    display: grid;
    grid-template-columns:
        clamp(90px, 20%, 340px)
        minmax(0, 1fr)
        clamp(90px, 20%, 340px);
    gap: 6px;
    align-items: start;
}

.dashboard-main .dashboard-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.dashboard-ads {
    position: sticky;
    top: 12px;
    align-self: start;
}

.dashboard-ads-rotator {
    position: relative;
}

/* всички карти са скрити по подразбиране */
.dashboard-ads-rotator .rotator-item {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px) scale(0.985);
    transition: opacity 0.8s ease,
    transform 0.8s ease,
    visibility 0s linear 0.8s;

    /* важно */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

/* само активната карта участва в layout-а */
.dashboard-ads-rotator .rotator-item.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.8s ease,
    transform 0.8s ease,
    visibility 0s linear 0s;

    position: relative;
    z-index: 2;
}

.dashboard-ad-card--desktop.rotator-item {
    width: 100%;
}

.dashboard-ad-card {
    background: linear-gradient(180deg, var(--card-bg, #ffffff), rgba(255, 255, 255, .96));
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .08);
}

.dashboard-ad-card--mobile {
    display: block;
    margin-bottom: 14px;
}

.dashboard-ad-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.dashboard-ad-media {
    background: color-mix(in srgb, var(--bg-page, #f7f7f8), #000 2%);
}

.dashboard-ad-media img,
.dashboard-ad-media video {
    display: block;
    width: 100%;
    max-height: 680px;
    object-fit: contain;
    background: #fff;
    margin: 6px;
}

.dashboard-ad-body {
    padding: 14px;
}

.dashboard-ad-title {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
    color: var(--txt, #1f2937);
}

.dashboard-ad-text {
    margin: 0;
    font-size: .95rem;
    line-height: 1.5;
    color: var(--txt-dim, #667085);
}

.dashboard-ad-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-page, #fff), #000 4%);
    font-size: .92rem;
    font-weight: 600;
}

.dashboard-ad-mobile-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 12px 12px 0;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: .78rem;
    font-weight: 700;
    color: var(--txt-dim, #667085);
    background: rgba(255, 255, 255, .75);
}

@media (max-width: 1100px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
        width: min(920px, calc(100% - 16px));
    }

    .dashboard-ads {
        display: none;
    }

    .dashboard-ad-card--mobile {
        display: block;
    }
}

/* утилити */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* гридът за вече качени снимки */
.post-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.post-images-grid img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* pending (новоизбрани за качване) */
.pending-block {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.pending-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.pending-title {
    font-weight: 600;
}

.pending-hint {
    margin: 8px 0 0;
    font-size: .85rem;
    color: var(--txt-dim);
}

.pending-chip {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.pending-chip img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.pending-meta {
    padding: 6px 8px;
    font-size: .85rem;
    color: var(--txt-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.pending-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    color: #fff;
    background: rgba(0, 0, 0, .6);
    cursor: pointer;
}

.pending-remove:hover {
    background: rgba(255, 0, 0, .7);
}

/* youtube контейнер (от филтъра) */
.yt-embed-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.yt-embed-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.yt-embed-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yt-embed-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(.8);
}

.yt-embed-play {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 28px;
}

/* Reaction popover */
.reaction-widget {
    position: relative;
    display: inline-block;
}

.react-trigger {
    position: relative;
}

.react-menu {
    position: absolute;
    inset: auto auto calc(100% + 6px) 0; /* по подразбиране над бутона */
    display: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 6px;
    gap: 6px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    z-index: 20;
}

.reaction-widget.open .react-menu {
    display: flex;
}

.react-choice {
    font-size: 20px;
    line-height: 1;
    border: none;
    background: transparent;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

.react-choice:hover {
    background: rgba(0, 0, 0, .06);
}

.react-menu.below {
    inset: calc(100% + 6px) auto auto 0;
}

.pending-block[hidden] {
    display: none !important;
}

.btn-compact {
    height: 32px;
}

.pinned-wrap {
    margin: 16px 0 8px;
}

.reactions-bar {
    min-height: 20px;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 6px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 14px;
    background: #f0f0f0;
    cursor: pointer;
    user-select: none;
    transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.reaction-pill:hover,
.reaction-pill:focus-visible {
    background: #e6eefc;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
    outline: none;
}

.reaction-users-popover {
    position: fixed;
    z-index: 5000;
    width: min(320px, calc(100vw - 20px));
    max-height: min(420px, calc(100vh - 20px));
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 16px 45px rgba(15, 23, 42, .18);
    color: var(--txt, #1f2937);
}

.reaction-users-popover[hidden] {
    display: none !important;
}

.reaction-users-popover-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 4px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
    margin-bottom: 6px;
}

.reaction-users-popover-title span {
    font-size: 1.05rem;
    line-height: 1;
}

.reaction-users-popover-title strong {
    font-size: .92rem;
    font-weight: 700;
}

.reaction-users-popover-title em {
    margin-left: auto;
    font-style: normal;
    font-size: .78rem;
    color: var(--txt-dim, #667085);
}

.reaction-users-list {
    display: grid;
    gap: 2px;
}

.reaction-user-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 5px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

.reaction-user-row:hover {
    background: rgba(37, 99, 235, .08);
    text-decoration: none;
}

.reaction-user-avatar {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
}

.reaction-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
    font-weight: 600;
}

.reaction-users-more {
    margin-top: 7px;
    padding: 7px 5px 2px;
    border-top: 1px solid rgba(0, 0, 0, .07);
    font-size: .84rem;
    color: var(--txt-dim, #667085);
}

.reaction-users-loading,
.reaction-users-empty,
.reaction-users-error {
    padding: 10px 8px;
    font-size: .9rem;
    color: var(--txt-dim, #667085);
}

.reaction-users-error {
    color: #b42318;
}

@media (max-width: 520px) {
    .reaction-users-popover {
        width: min(300px, calc(100vw - 18px));
        max-height: min(360px, calc(100vh - 18px));
        padding: 9px;
    }

    .reaction-user-row {
        grid-template-columns: 30px minmax(0, 1fr);
        padding: 6px 4px;
    }

    .reaction-user-avatar {
        width: 30px;
        height: 30px;
    }
}

.comments-closed-note {
    margin-top: 8px;
    font-size: .95rem;
    color: var(--txt-dim);
}

.activity-item--empty {
    padding: 20px;
    text-align: center;
}

.admin-post-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* emoji popover */
.emoji-popover {
    position: fixed;
    z-index: 9999;
    display: block;
    overflow: hidden;
    max-height: 60vh;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

.emoji-popover[hidden] {
    display: none !important;
}

.emoji-picker-panel {
    width: 320px;
    height: 380px;
}

.yt-watch-link {
    display: inline-block;
    margin-top: 6px;
}

.dashboard-feed-loader {
    padding: 16px;
    text-align: center;
    font-size: .95rem;
    color: var(--txt-dim);
}

.dashboard-feed-loader[hidden] {
    display: none !important;
}

.dashboard-feed-sentinel {
    width: 100%;
    height: 1px;
}

.post-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-text.is-collapsed {
    max-height: 10.5em;
    overflow: hidden;
}

.post-see-more {
    display: none;
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link-color, #2563eb);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.post-see-more.is-visible {
    display: inline-block;
}

.post-see-more:hover {
    text-decoration: underline;
}

.comments-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.comments-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 4px 8px;
    border-radius: 999px;
    opacity: 0.9;
}

.comments-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    opacity: 1;
}

.comments-loader {
    font-size: 0.9rem;
    opacity: 0.7;
}

.comments-list[hidden] {
    display: none !important;
}

.comments-empty {
    font-size: 0.9rem;
    opacity: 0.7;
    padding: 6px 0 8px 42px;
}

/* Dynamic comment textarea */
.comment-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.comment-form .presence-anchor.is-sm {
    flex: 0 0 auto;
    align-self: flex-end;
}

.comment-input-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: end;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.comment-input-wrapper .comment-textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    max-height: calc((1.35em * 4) + 22px);
    padding: 9px 12px;
    border: 0px;
    border-radius: 8px;
    background: #fff;
    color: var(--txt, #1f2937);
    font: inherit;
    line-height: 1.35;
    resize: none;
    overflow-y: hidden;
    box-sizing: border-box;
    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        border-radius .15s ease;
}

.comment-input-wrapper .comment-textarea:focus {
    outline: none;
}

.comment-image-upload {
    flex: 0 0 auto;
    align-self: end;
    min-height: 38px;
    cursor: pointer;
}

.comment-image-upload.has-file {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.comment-image-link {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-top: 8px;
}

.comment-image {
    display: block;
    max-width: min(420px, 100%);
    max-height: 320px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
}

.comment-input-wrapper .comment-emoji,
.comment-input-wrapper .comment-submit-btn {
    flex: 0 0 auto;
    align-self: end;
    min-height: 38px;
}

@media (max-width: 520px) {
    .comment-form {
        gap: 6px;
    }

    .comment-input-wrapper {
        grid-template-columns: minmax(0, 1fr) 38px;
        grid-template-rows: minmax(0, 1fr) 38px 38px 38px;
        align-items: stretch;
        gap: 6px;
        overflow: visible;
    }

    .comment-input-wrapper .comment-textarea {
        grid-column: 1;
        grid-row: 1 / 5;
        min-height: 132px; /* 38 + 6 + 38 + 6 + 38 + 6 */
        padding: 8px 10px;
        font-size: .92rem;
        line-height: 1.35;
        align-self: stretch;
    }

    .comment-input-wrapper .comment-emoji {
        grid-column: 2;
        grid-row: 2;
    }

    .comment-input-wrapper .comment-image-upload {
        grid-column: 2;
        grid-row: 3;
    }

    .comment-input-wrapper .comment-submit-btn {
        grid-column: 2;
        grid-row: 4;
    }

    .comment-input-wrapper .comment-emoji,
    .comment-input-wrapper .comment-image-upload,
    .comment-input-wrapper .comment-submit-btn {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        align-self: center;
        justify-self: center;
    }
}

@media (max-width: 380px) {
    .comment-form .presence-anchor.is-sm {
        display: none;
    }

    .comment-input-wrapper {
        grid-template-columns: minmax(0, 1fr) 36px;
        grid-template-rows: minmax(0, 1fr) 36px 36px 36px;
    }

    .comment-input-wrapper .comment-textarea {
        grid-row: 1 / 5;
        min-height: 126px;
    }

    .comment-input-wrapper .comment-emoji,
    .comment-input-wrapper .comment-image-upload,
    .comment-input-wrapper .comment-submit-btn {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
    }
}

/* Comment replies + comment reactions */
.comment {
    align-items: flex-start;
}

.comment--reply {
    margin-left: 42px;
}

.comment-main {
    flex: 1 1 auto;
    min-width: 0;
}

.comment-body {
    min-width: 0;
}

.comment-reply-context {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--txt-dim, #667085);
}

.comment-reply-context a {
    color: inherit;
    font-weight: 600;
}

.comment-inline-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
    font-size: 0.82rem;
    line-height: 1.2;
}

.comment-reply-btn,
.comment-react-trigger {
    border: 0;
    background: transparent;
    color: var(--txt-dim, #667085);
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.2;
    padding: 2px 4px;
    border-radius: 999px;
    cursor: pointer;
}

.comment-reply-btn:hover,
.comment-react-trigger:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--txt, #1f2937);
}

.comment-action-separator {
    color: var(--txt-dim, #667085);
    opacity: 0.7;
}

.comment-reactions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
    margin-top: 4px;
}

.comment-reaction-pill {
    font-size: 0.8rem;
    padding: 1px 6px;
}

.comment-reaction-widget {
    position: relative;
}

.comment-reaction-widget .react-menu {
    z-index: 1200;
}

.comment-form-main {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: 6px;
}

.comment-reply-target {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--txt-dim, #667085);
    font-size: 0.82rem;
    line-height: 1.2;
}

.comment-reply-target[hidden] {
    display: none !important;
}

.comment-reply-target strong {
    color: var(--txt, #1f2937);
}

.comment-reply-cancel {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.comment-reply-cancel:hover {
    color: #b42318;
}

@media (max-width: 520px) {
    .comment--reply {
        margin-left: 24px;
    }

    .comment-inline-actions {
        gap: 5px;
        font-size: 0.78rem;
    }

    .comment-reply-btn,
    .comment-react-trigger {
        font-size: 0.78rem;
    }

    .comment-reply-target {
        font-size: 0.78rem;
        border-radius: 12px;
    }
}

@media (max-width: 380px) {
    .comment--reply {
        margin-left: 12px;
    }
}

/* =====================================================
   Dashboard post uploaded images — controlled size, no crop
   ===================================================== */

/* Единична снимка към пост */
.activity-content > .post-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: clamp(240px, 38vw, 460px);
    object-fit: contain;
    object-position: center;
    margin-top: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
}

/* Галерия от качени снимки */
.activity-content .post-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: 10px;
    margin-top: 10px;
}

/* Ако в галерията има само една снимка — центрирай я */
.activity-content .post-images-grid:has(> a:only-child) {
    grid-template-columns: minmax(0, min(520px, 100%));
    justify-content: center;
}

.activity-content .post-images-grid a {
    display: block;
    min-width: 0;
}

.activity-content .post-images-grid img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
}

/* Мобилно */
@media (max-width: 560px) {
    .activity-content > .post-image {
        height: clamp(220px, 72vw, 340px);
    }

    .activity-content .post-images-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .activity-content .post-images-grid:has(> a:only-child) {
        grid-template-columns: 1fr;
    }

    .activity-content .post-images-grid img {
        width: 100%;
        height: auto;
        max-height: 340px;
    }
}

.comment-image-preview {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.comment-image-preview[hidden] {
    display: none !important;
}

.comment-image-preview-thumb {
    display: block;
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
}

.comment-image-preview-meta {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.comment-image-preview-meta strong {
    font-size: 0.88rem;
    line-height: 1.2;
    color: var(--txt, #1f2937);
}

.comment-image-preview-meta span {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--txt-dim, #667085);
}

.comment-image-preview-meta small {
    font-size: 0.78rem;
    color: var(--txt-dim, #667085);
}

.comment-image-preview-remove {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--txt-dim, #667085);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}

.comment-image-preview-remove:hover {
    background: rgba(180, 35, 24, 0.12);
    color: #b42318;
}

.comment-image-upload.has-file {
    background: rgba(37, 99, 235, 0.10);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

@media (max-width: 520px) {
    .comment-image-preview {
        grid-template-columns: 48px minmax(0, 1fr) 30px;
        width: 100%;
        padding: 7px 8px;
    }

    .comment-image-preview-thumb {
        width: 48px;
        height: 48px;
    }

    .comment-image-preview-meta span {
        max-width: 180px;
    }

    .comment-image-preview-meta small {
        display: none;
    }
}

/* Dashboard thread notification preferences */
.thread-notification-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--txt-dim, #667085);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    padding: 4px 8px;
    border-radius: 999px;
}

.thread-notification-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--txt, #1f2937);
}

.thread-notification-toggle.is-muted {
    opacity: 0.82;
}

.thread-notification-toggle:disabled {
    cursor: wait;
    opacity: 0.55;
}

.thread-notification-toggle[hidden] {
    display: none !important;
}

@media (max-width: 620px) {
    .comments-summary {
        flex-wrap: wrap;
    }

    .thread-notification-toggle {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}
