/* Global Variables */
:root {
    --sns-max-width: 920px;
    --sns-panel-width: 320px;
    --sns-bg-color: var(--bg-primary);
    --sns-card-bg: transparent;
    --sns-border-radius-lg: 10px;
    --sns-border-radius-md: 8px;
    --sns-border-radius-sm: 6px;
    --sns-media-cell: 88px;
}

.sns-page-layout {
    display: flex;
    height: calc(100% + 48px);
    margin: -24px;
    overflow: hidden;
    background: var(--sns-bg-color);
    position: relative;
    color: var(--text-primary);
}

/* =========================================
   Main Viewport & Feed
   ========================================= */
.sns-main-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

.sns-feed-container {
    width: 100%;
    max-width: var(--sns-max-width);
    padding: 14px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    height: 100%;
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 0;
    padding: 2px 2px 10px;
    z-index: 2;
    background: var(--sns-bg-color);
    border-bottom: 1px solid var(--border-color);

    .feed-header-main {
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 0;

        h2 {
            font-size: 20px;
            font-weight: 700;
            margin: 0;
            color: var(--text-primary);
        }
    }

    .feed-stats-line {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        font-size: 12px;
        color: var(--text-secondary);
        line-height: 1.4;

        &.loading {
            opacity: 0.7;
        }

        &.error {
            color: #d94f45;
        }
    }

    .feed-stats-range {
        gap: 0;
    }

    .feed-overview-total {
        font-size: inherit;
        color: inherit;
        white-space: nowrap;
    }

    .feed-stats-divider {
        color: color-mix(in srgb, var(--text-secondary) 78%, transparent);
    }

    .feed-my-timeline-entry {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: fit-content;
        padding: 0;
        border: none;
        background: transparent;
        font-size: 13px;
        line-height: 1.4;
        color: var(--text-secondary);
        cursor: default;
        transition: color 0.2s ease, opacity 0.2s ease;

        .feed-my-timeline-label {
            font-weight: 500;
        }

        .feed-my-timeline-count {
            color: var(--text-primary);
            font-weight: 600;
            display: inline-flex;
            align-items: center;

            .spin {
                animation: spin 0.8s linear infinite;
            }
        }

        &.ready {
            cursor: pointer;

            &:hover {
                color: var(--primary);
            }

            &:hover .feed-my-timeline-count {
                color: var(--primary);
            }

            &:focus-visible {
                outline: 2px solid var(--primary);
                outline-offset: 3px;
                border-radius: 6px;
            }
        }

        &.loading {
            opacity: 0.72;
        }

        &:disabled {
            opacity: 0.68;
        }
    }

    .feed-stats-retry {
        border: none;
        background: transparent;
        color: inherit;
        font-size: 13px;
        padding: 0;
        line-height: 1.4;
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .jump-calendar-anchor {
        position: relative;
        display: flex;
        align-items: center;
        isolation: isolate;
        z-index: 20;

        .jump-date-popover {
            z-index: 2600;
        }
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: var(--sns-border-radius-sm);
        padding: 0;
        color: var(--text-secondary);
        cursor: pointer;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;

        &:hover {
            background: var(--bg-hover);
            border-color: color-mix(in srgb, var(--text-tertiary) 34%, var(--border-color));
            color: var(--text-primary);
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .spinning {
            animation: spin 0.8s linear infinite;
        }
    }

    .jump-date-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid var(--border-color);
        border-radius: var(--sns-border-radius-sm);
        background: transparent;
        color: var(--text-secondary);
        min-height: 32px;
        padding: 0 9px;
        cursor: pointer;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;

        &:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
        }

        &.active {
            border-color: var(--primary);
            background: rgba(var(--primary-rgb), 0.07);
            color: var(--primary);
        }
    }

    .jump-date-chip-label {
        font-size: 13px;
        font-weight: 500;
        line-height: 1;
        white-space: nowrap;
    }

    .jump-date-chip-clear {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: inherit;
        border-radius: 999px;
        padding: 1px;

        &:hover {
            background: color-mix(in srgb, var(--primary) 12%, transparent);
        }
    }
}

.sns-posts-stage {
    flex: 1;
    min-height: 0;
    position: relative;
}

.sns-posts-scroll {
    height: 100%;
    overflow-y: auto;
    padding-top: 8px;
}

.sns-post-row {
    padding-bottom: 10px;
}

.feed-contact-filter-bar {
    margin: 8px 0 0;
    padding: 7px 9px;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border-color));
    border-radius: var(--sns-border-radius-md);
    background: rgba(var(--primary-rgb), 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;

    .feed-contact-filter-label {
        font-size: 12px;
        color: var(--text-secondary);
        white-space: nowrap;
    }

    .feed-contact-filter-summary {
        font-size: 12px;
        color: var(--text-primary);
        font-weight: 600;
        min-width: 0;
    }

    .feed-contact-filter-clear {
        margin-left: auto;
        border: none;
        background: transparent;
        color: var(--primary);
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        padding: 0;
        white-space: nowrap;

        &:hover {
            text-decoration: underline;
            text-underline-offset: 2px;
        }
    }
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* =========================================
   Post Item Component
   ========================================= */
.sns-post-item {
    background: var(--sns-card-bg);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
    padding: 10px 6px 12px;
    display: flex;
    gap: 12px;
    transition: background 0.15s ease;
    box-shadow: none;
    position: relative;
    overflow: visible;

    &:hover {
        background: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
        box-shadow: none;
        transform: none;
    }

    &.post-deleted {
        opacity: 0.7;
    }

    .post-deleted-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        background: rgba(255, 77, 79, 0.1);
        color: #ff4d4f;
        font-size: 11px;
        font-weight: 500;
        padding: 2px 6px;
        border-radius: 6px;
    }
}

.post-avatar-col {
    flex-shrink: 0;
}

.author-trigger-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
}

.avatar-trigger {
    border-radius: var(--sns-border-radius-md);
    transition: opacity 0.15s ease;

    &:hover {
        opacity: 0.86;
        box-shadow: none;
    }

    &:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }
}

.post-content-col {
    flex: 1;
    min-width: 0;
    /* Enable ellipsis */
}

.post-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;

    .post-author-info {
        display: flex;
        flex-direction: column;
        min-width: 0;
        overflow: hidden;

        .author-name {
            font-size: 14px;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 1px;
        }

        .author-name-trigger {
            align-self: flex-start;
            border-radius: 6px;
            margin-bottom: 2px;

            .author-name {
                transition: color 0.15s ease, text-decoration-color 0.15s ease;
                text-decoration: underline;
                text-decoration-color: transparent;
                text-underline-offset: 2px;
                margin-bottom: 0;
            }

            &:hover .author-name {
                color: var(--primary);
                text-decoration-color: currentColor;
            }

            &:focus-visible {
                outline: 2px solid var(--primary);
                outline-offset: 2px;
            }
        }

        .post-time {
            font-size: 12px;
            color: var(--text-tertiary);
            line-height: 1.25;
        }
    }

    .post-header-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .post-time-standalone {
        font-size: 12px;
        color: var(--text-tertiary);
        line-height: 1.2;
        padding-top: 2px;
    }

    .debug-btn {
        opacity: 0;
        transition: opacity 0.2s;
        background: none;
        border: none;
        border-radius: 6px;
        width: 24px;
        height: 24px;
        padding: 0;
        color: var(--text-tertiary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }

        &.delete-btn:hover {
            color: #ff4d4f;
            border-color: rgba(255, 77, 79, 0.4);
            background: rgba(255, 77, 79, 0.08);
        }

        &:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
    }

    .post-protected-badge {
        display: flex;
        align-items: center;
        gap: 3px;
        opacity: 0;
        transition: opacity 0.2s;
        color: var(--color-success, #4caf50);
        font-size: 11px;
        font-weight: 500;
        padding: 3px 7px;
        border-radius: 5px;
        background: rgba(76, 175, 80, 0.08);
        border: 1px solid rgba(76, 175, 80, 0.2);
    }
}

.sns-post-item:hover .debug-btn {
    opacity: 1;
}

.sns-post-item:hover .post-protected-badge {
    opacity: 1;
}

// 删除确认弹窗
.sns-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.sns-confirm-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 28px 22px;
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);

    .sns-confirm-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: rgba(255, 77, 79, 0.1);
        color: #ff4d4f;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 4px;
    }

    .sns-confirm-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary);
    }

    .sns-confirm-desc {
        font-size: 13px;
        color: var(--text-secondary);
        text-align: center;
        line-height: 1.5;
        margin-bottom: 8px;
    }

    .sns-confirm-actions {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-top: 4px;

        button {
            flex: 1;
            height: 36px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            border: 1px solid var(--border-color);
            transition: all 0.15s;
        }

        .sns-confirm-cancel {
            background: var(--bg-tertiary);
            color: var(--text-secondary);

            &:hover {
                background: var(--bg-hover);
                color: var(--text-primary);
            }
        }

        .sns-confirm-ok {
            background: #ff4d4f;
            color: #fff;
            border-color: #ff4d4f;

            &:hover {
                background: #ff7875;
                border-color: #ff7875;
            }
        }
    }
}

// 朋友圈防删除插件对话框
.sns-protect-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 340px;
    padding: 32px 28px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);

    .sns-protect-close {
        position: absolute;
        top: 14px;
        right: 14px;
        background: none;
        border: none;
        color: var(--text-tertiary);
        cursor: pointer;
        padding: 4px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }
    }

    .sns-protect-hero {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-bottom: 20px;
    }

    .sns-protect-icon-wrap {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        background: var(--bg-tertiary);
        color: var(--text-tertiary);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s;

        &.active {
            background: rgba(76, 175, 80, 0.12);
            color: var(--color-success, #4caf50);
        }
    }

    .sns-protect-title {
        font-size: 17px;
        font-weight: 600;
        color: var(--text-primary);
    }

    .sns-protect-status-badge {
        font-size: 12px;
        font-weight: 500;
        padding: 3px 10px;
        border-radius: 20px;

        &.on {
            background: rgba(76, 175, 80, 0.12);
            color: var(--color-success, #4caf50);
        }

        &.off {
            background: var(--bg-tertiary);
            color: var(--text-tertiary);
        }
    }

    .sns-protect-desc {
        font-size: 13px;
        color: var(--text-secondary);
        text-align: center;
        line-height: 1.6;
        margin-bottom: 16px;
    }

    .sns-protect-feedback {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        padding: 8px 12px;
        border-radius: 8px;
        width: 100%;
        margin-bottom: 14px;
        box-sizing: border-box;

        &.success {
            background: rgba(76, 175, 80, 0.1);
            color: var(--color-success, #4caf50);
        }

        &.error {
            background: rgba(244, 67, 54, 0.1);
            color: var(--color-error, #f44336);
        }
    }

    .sns-protect-actions {
        width: 100%;
    }

    .sns-protect-btn {
        width: 100%;
        height: 40px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        transition: all 0.15s;

        &.primary {
            background: var(--color-primary, #1677ff);
            color: #fff;

            &:hover:not(:disabled) {
                filter: brightness(1.1);
            }
        }

        &.danger {
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            border: 1px solid var(--border-color);

            &:hover:not(:disabled) {
                background: rgba(255, 77, 79, 0.08);
                color: #ff4d4f;
                border-color: rgba(255, 77, 79, 0.3);
            }
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }
}

.post-text {
    font-size: 14px;
    line-height: 1.48;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 8px;
}

.post-location {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: -2px 0 8px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);

    svg {
        flex-shrink: 0;
        margin-top: 1px;
        color: var(--text-tertiary);
    }
}

.post-location-text {
    word-break: break-word;
}

.post-media-container {
    margin-bottom: 8px;
}

.post-link-card {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--sns-border-radius-md);
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
    margin-bottom: 8px;

    &:hover {
        background: rgba(var(--primary-rgb), 0.08);
        border-color: rgba(var(--primary-rgb), 0.3);
    }

    .link-thumb {
        width: 48px;
        height: 48px;
        border-radius: var(--sns-border-radius-sm);
        overflow: hidden;
        flex-shrink: 0;
        background: var(--bg-secondary);

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .link-thumb-fallback {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-tertiary);
        }
    }

    .link-meta {
        flex: 1;
        min-width: 0;

        .link-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-primary);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .link-url {
            font-size: 11px;
            color: var(--text-tertiary);
            margin-top: 4px;
        }
    }

    .link-arrow {
        color: var(--text-tertiary);
    }
}

.post-interactions {
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
    font-size: 12px;

    .likes-block {
        display: flex;
        gap: 6px;
        margin-bottom: 6px;
        color: var(--primary);
        font-weight: 500;

        .like-icon {
            margin-top: 2px;
        }
    }

    .comments-block {
        background: var(--bg-tertiary);
        border-radius: var(--sns-border-radius-sm);
        padding: 6px 8px;

        .comment-row {
            margin-bottom: 3px;
            line-height: 1.45;
            color: var(--text-secondary);

            &:last-child {
                margin-bottom: 0;
            }

            .comment-user {
                color: var(--primary);
                font-weight: 500;
            }

            .reply-text {
                margin: 0 4px;
                color: var(--text-tertiary);
            }

            .comment-colon {
                margin-right: 4px;
            }

            .comment-custom-emoji {
                display: inline-block;
                vertical-align: middle;
                border-radius: 4px;
                margin-left: 2px;
            }
        }
    }
}


/* =========================================
   Media Grid Component
   ========================================= */
.sns-media-grid {
    display: grid;
    gap: 4px;

    &.grid-1 .sns-media-item {
        width: fit-content;
        height: auto;
        max-width: 270px;
        max-height: 340px;
        aspect-ratio: auto;
        border-radius: var(--sns-border-radius-md);

        &.deleted-media {
            width: 200px;
            aspect-ratio: 1;
        }

        img,
        video {
            max-width: 100%;
            max-height: 340px;
            width: auto;
            height: auto;
            object-fit: contain;
            display: block;
            background: rgba(0, 0, 0, 0.05);
        }
    }

    &.grid-2,
    &.grid-4 {
        grid-template-columns: repeat(2, var(--sns-media-cell));
        max-width: calc((var(--sns-media-cell) * 2) + 4px);
    }

    &.grid-3,
    &.grid-6,
    &.grid-9 {
        grid-template-columns: repeat(3, var(--sns-media-cell));
        max-width: calc((var(--sns-media-cell) * 3) + 8px);
    }

    .sns-media-item {
        position: relative;
        aspect-ratio: 1;
        border-radius: var(--sns-border-radius-sm);
        overflow: hidden;
        cursor: zoom-in;
        background: var(--bg-tertiary);
        transition: opacity 0.15s ease;

        &:hover {
            opacity: 0.9;
        }

        img,
        video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            animation: fade-in 0.2s ease;
        }

        .media-badge {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 32px;
            height: 32px;
            background: rgba(0, 0, 0, 0.4);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            pointer-events: none;
            /* Let clicks pass through badge to item */

            &.live {
                top: 6px;
                right: 6px;
                left: auto;
                transform: none;
                width: 24px;
                height: 24px;
            }

        }

        .media-decrypting-mask {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.6);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: white;
            gap: 8px;
            z-index: 10;
            font-size: 12px;
        }

        .media-download-btn {
            position: absolute;
            bottom: 5px;
            right: 5px;
            width: 24px;
            height: 24px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.15s ease, background 0.15s ease;
            z-index: 5;

            &:hover {
                background: var(--primary);
            }

            /* Increase click area */
            &::after {
                content: '';
                position: absolute;
                inset: -4px;
            }
        }

        &:hover .media-download-btn {
            opacity: 1;
        }

        &.deleted-media {
            cursor: default;
            opacity: 0.6;

            .deleted-placeholder {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                height: 100%;
                gap: 6px;
                color: var(--text-tertiary);
                font-size: 12px;
            }
        }
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* =========================================
   Filter Panel Component (Right Side)
   ========================================= */
.sns-filter-panel {
    width: var(--sns-panel-width);
    flex-shrink: 0;
    border-left: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    gap: 14px;
    z-index: 10;

    .filter-header {
        display: flex;
        justify-content: space-between;
        align-items: center;

        h3 {
            font-size: 15px;
            font-weight: 650;
            margin: 0;
        }

        .reset-all-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-tertiary);
            width: 28px;
            height: 28px;
            border-radius: var(--sns-border-radius-sm);
            display: inline-flex;
            align-items: center;
            justify-content: center;

            &:hover {
                background: var(--bg-hover);
                color: var(--text-primary);
            }
        }
    }

    .filter-widgets {
        display: flex;
        flex-direction: column;
        gap: 14px;
        flex: 1;
        min-height: 0;
    }

    .filter-widget {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;

        .widget-header {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 8px;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);

            svg {
                color: var(--text-tertiary);
                opacity: 1;
            }

            .badge {
                margin-left: auto;
                background: var(--primary);
                color: white;
                font-size: 10px;
                padding: 2px 6px;
                border-radius: 10px;
            }

            .widget-header-summary {
                margin-left: auto;
                font-size: 12px;
                font-weight: 400;
                color: var(--text-tertiary);
                white-space: nowrap;
            }
        }
    }

    .contact-widget .widget-header .badge + .widget-header-summary {
        margin-left: 8px;
    }

    /* Search Widget */
    .input-group {
        position: relative;
        display: flex;
        align-items: center;

        input {
            width: 100%;
            background: var(--bg-tertiary);
            border: 1px solid transparent;
            border-radius: var(--sns-border-radius-sm);
            height: 34px;
            padding: 0 30px 0 10px;
            font-size: 13px;
            color: var(--text-primary);
            transition: background 0.15s ease, border-color 0.15s ease;

            &:focus {
                background: var(--bg-secondary);
                border-color: transparent;
                outline: none;
                box-shadow: none;
            }
        }

        .clear-input-btn {
            position: absolute;
            right: 8px;
            background: none;
            border: none;
            padding: 2px;
            cursor: pointer;
            color: var(--text-tertiary);
            display: flex;
        }
    }

    /* Contact Widget - Refactored */
    .contact-widget {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 300px;
        overflow: hidden;
        padding: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 12px;

        .widget-header {
            padding: 0;
            margin-bottom: 8px;
        }

        .contact-search-bar {
            padding: 0 0 10px;
            position: relative;
            border-bottom: 1px solid var(--border-color);

            input {
                width: 100%;
                background: var(--bg-tertiary);
                border: 1px solid transparent;
                border-radius: var(--sns-border-radius-sm);
                height: 32px;
                padding: 0 32px 0 10px;
                font-size: 12px;
                color: var(--text-primary);

                &:focus {
                    outline: none;
                    background: var(--bg-secondary);
                    border-color: transparent;
                }
            }

            .search-icon {
                position: absolute;
                right: 10px;
                top: 9px;
                color: var(--text-tertiary);
                pointer-events: none;
                display: none;
            }

            .clear-icon {
                position: absolute;
                right: 10px;
                top: 9px;
                color: var(--text-tertiary);
                cursor: pointer;
                display: flex;
                align-items: center;
            }
        }

        .contact-selection-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 8px 0;
            border-bottom: 1px dashed color-mix(in srgb, var(--border-color) 72%, transparent);
        }

        .contact-selection-summary {
            min-width: 0;
            font-size: 11px;
            color: var(--text-tertiary);
            font-variant-numeric: tabular-nums;
        }

        .contact-selection-toggle {
            flex-shrink: 0;
            border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border-color));
            background: color-mix(in srgb, var(--bg-primary) 84%, rgba(var(--primary-rgb), 0.08));
            color: var(--text-secondary);
            border-radius: 999px;
            padding: 4px 9px;
            font-size: 12px;
            font-weight: 500;
            line-height: 1.2;
            cursor: pointer;
            transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;

            &:hover:not(:disabled) {
                border-color: color-mix(in srgb, var(--primary) 40%, var(--border-color));
                color: var(--primary);
            }

            &.active {
                border-color: color-mix(in srgb, var(--primary) 40%, var(--border-color));
                background: rgba(var(--primary-rgb), 0.12);
                color: var(--primary);
            }

            &:disabled {
                opacity: 0.45;
                cursor: not-allowed;
            }
        }

        .contact-count-progress {
            padding: 7px 0 8px;
            font-size: 11px;
            color: var(--text-tertiary);
            border-bottom: 1px dashed color-mix(in srgb, var(--border-color) 70%, transparent);
            font-variant-numeric: tabular-nums;
        }

        .contact-interaction-hint {
            padding: 8px 0 0;
            font-size: 11px;
            line-height: 1.5;
            color: var(--text-tertiary);
        }

        .contact-list-scroll {
            flex: 1;
            min-height: 0;
            padding: 8px 0 0;

            .contact-list-virtuoso {
                height: 100%;
            }

            .contact-row {
                display: flex;
                align-items: center;
                gap: 4px;
                min-height: 40px;
                border-radius: var(--sns-border-radius-sm);
                transition: background 0.15s ease;

                &.is-selected .contact-main-btn {
                    background: rgba(var(--primary-rgb), 0.06);
                    border-color: color-mix(in srgb, var(--primary) 20%, var(--border-color));
                }

                &.is-active .contact-main-btn {
                    background: rgba(var(--primary-rgb), 0.12);
                    border-color: color-mix(in srgb, var(--primary) 48%, var(--border-color));
                    box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.18);
                }

                &.is-active .contact-name {
                    color: var(--text-primary);
                }

                .contact-select-btn {
                    width: 28px;
                    height: 32px;
                    flex-shrink: 0;
                    border: none;
                    background: transparent;
                    border-radius: 8px;
                    color: var(--text-tertiary);
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;
                    cursor: pointer;
                    transition: background 0.15s ease, color 0.15s ease;

                    &:hover {
                        background: rgba(var(--primary-rgb), 0.1);
                        color: var(--primary);
                    }

                    &.checked {
                        color: var(--primary);
                    }
                }

                .contact-main-btn {
                    flex: 1;
                    min-width: 0;
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    padding: 5px 6px;
                    border-radius: var(--sns-border-radius-sm);
                    border: 1px solid transparent;
                    background: transparent;
                    cursor: pointer;
                    transition: background 0.15s ease, border-color 0.15s ease;
                    text-align: left;

                    &:hover {
                        background: var(--bg-hover);
                    }
                }

                .contact-meta {
                    flex: 1;
                    min-width: 0;
                    display: flex;
                    flex-direction: column;
                    gap: 2px;

                    .contact-name {
                        font-size: 13px;
                        color: var(--text-secondary);
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                    }
                }

                .contact-post-count-wrap {
                    margin-left: 8px;
                    min-width: 42px;
                    display: flex;
                    justify-content: flex-end;
                    align-items: center;
                    flex-shrink: 0;
                }

                .contact-post-count {
                    font-size: 11px;
                    color: var(--text-tertiary);
                    font-variant-numeric: tabular-nums;
                    white-space: nowrap;
                }

                .contact-post-count-loading {
                    color: var(--text-tertiary);
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;

                    .spinning {
                        animation: spin 0.8s linear infinite;
                    }
                }
            }
        }

        .contact-batch-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 0 0;
            border-top: 1px solid var(--border-color);
            background: transparent;
        }

        .contact-batch-summary {
            flex: 1;
            min-width: 0;
            font-size: 12px;
            color: var(--text-secondary);
            font-variant-numeric: tabular-nums;
        }

        .contact-batch-btn {
            border: 1px solid var(--border-color);
            background: var(--bg-secondary);
            color: var(--text-secondary);
            border-radius: var(--sns-border-radius-sm);
            height: 30px;
            padding: 0 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: 12px;
            cursor: pointer;
            transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;

            &:hover {
                border-color: var(--text-tertiary);
                background: var(--bg-hover);
                color: var(--text-primary);
            }

            &.primary {
                border-color: color-mix(in srgb, var(--primary) 35%, var(--border-color));
                background: rgba(var(--primary-rgb), 0.12);
                color: var(--primary);
            }
        }

        .empty-state {
            text-align: center;
            color: var(--text-tertiary);
            padding: 20px;
            font-size: 12px;
        }
    }
}

/* =========================================
   Status Indicators, etc.
   ========================================= */
.status-indicator {
    text-align: center;
    padding: 10px 8px;
    color: var(--text-tertiary);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    &.newer-hint {
        background: rgba(var(--primary-rgb), 0.1);
        color: var(--primary);
        cursor: pointer;
        border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border-color));
        border-radius: var(--sns-border-radius-sm);
        margin: 0 0 8px;
        width: 100%;
    }
}

/* Initial Loading Animation */
.initial-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 0;

    .loading-pulse {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;

        .pulse-circle {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--primary, #576b95);
            opacity: 0.4;
            animation: pulse-ring 1.2s ease-in-out infinite;
        }

        span {
            font-size: 12px;
            color: var(--text-tertiary);
        }
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.85);
        opacity: 0.2;
    }

    50% {
        transform: scale(1);
        opacity: 0.45;
    }

    100% {
        transform: scale(0.85);
        opacity: 0.2;
    }
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 0;
    color: var(--text-tertiary);

    .no-results-icon {
        margin-bottom: 10px;
        opacity: 0.5;
    }

    p {
        margin: 0;
        font-size: 13px;
    }

    .reset-inline {
        margin-top: 12px;
        background: none;
        border: 1px solid var(--border-color);
        padding: 6px 12px;
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-secondary);

        &:hover {
            border-color: var(--primary);
            color: var(--primary);
        }
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* =========================================
   Modal & Debug Dialog
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.debug-dialog {
    background: var(--sns-card-bg);
    /* Use card bg */
    border-radius: var(--sns-border-radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    width: 600px;
    max-width: 90vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    /* Ensure header doesn't overflow corners */
    animation: slide-up-fade 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    .debug-dialog-header {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        /* Distinct header bg */
        display: flex;
        align-items: center;
        justify-content: space-between;

        h3 {
            margin: 0;
            font-size: 16px;
            font-weight: 700;
            color: var(--text-primary);
        }

        .close-btn {
            background: none;
            border: none;
            color: var(--text-tertiary);
            cursor: pointer;
            padding: 6px;
            border-radius: 6px;
            display: flex;

            &:hover {
                background: var(--bg-primary);
                color: var(--text-primary);
            }
        }
    }

    .debug-dialog-body {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        background: var(--bg-primary);

        .json-code {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 12px;
            line-height: 1.5;
            color: var(--text-primary);
            white-space: pre-wrap;
            word-break: break-all;
            margin: 0;
            user-select: text;
            /* Allow selection */
        }
    }
}

.sns-cache-migration-dialog {
    background: var(--bg-secondary);
    border-radius: var(--sns-border-radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    width: 540px;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    animation: slide-up-fade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sns-cache-migration-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;

    &:hover:not(:disabled) {
        background: var(--bg-primary);
        color: var(--text-primary);
    }

    &:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }
}

.sns-cache-migration-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.sns-cache-migration-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.sns-cache-migration-subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sns-cache-migration-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sns-cache-migration-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;

    strong {
        font-size: 16px;
        color: var(--text-primary);
    }
}

.sns-cache-migration-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sns-cache-migration-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.sns-cache-migration-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #34d399, #10b981);
    transition: width 0.2s ease;
}

.sns-cache-migration-progress-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.sns-cache-migration-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.sns-cache-migration-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    padding: 8px 10px;
}

.sns-cache-migration-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sns-cache-migration-item-detail {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.45;
}

.sns-cache-migration-error,
.sns-cache-migration-success {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
}

.sns-cache-migration-error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--color-error, #f44336);
}

.sns-cache-migration-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--color-success, #4caf50);
}

.sns-cache-migration-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 0 20px 18px;
}

.sns-cache-migration-btn {
    min-width: 110px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;

    &.primary {
        background: var(--primary, #576b95);
        color: #fff;
    }

    &.secondary {
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        border-color: var(--border-color);
    }

    &:hover:not(:disabled) {
        filter: brightness(1.05);
    }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.author-timeline-dialog {
    background: var(--sns-card-bg);
    border-radius: var(--sns-border-radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    width: min(860px, 94vw);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: slide-up-fade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.author-timeline-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    .close-btn {
        background: none;
        border: none;
        color: var(--text-tertiary);
        cursor: pointer;
        padding: 6px;
        border-radius: 6px;
        display: flex;

        &:hover {
            background: var(--bg-primary);
            color: var(--text-primary);
        }
    }
}

.author-timeline-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.author-timeline-meta-text {
    min-width: 0;

    h3 {
        margin: 0;
        font-size: 16px;
        color: var(--text-primary);
    }
}

.author-timeline-username {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

.author-timeline-stats {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.author-timeline-body {
    padding: 16px;
    overflow-y: auto;
    min-height: 180px;
    max-height: calc(86vh - 96px);
}

.author-timeline-posts-list {
    gap: 16px;
}

.author-timeline-loading {
    margin-top: 12px;
}

.author-timeline-empty {
    padding: 42px 10px 30px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.author-timeline-load-more {
    display: block;
    margin: 12px auto 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;

    &:hover:not(:disabled) {
        color: var(--primary);
        border-color: var(--primary);
    }

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Export Dialog
   ========================================= */
.export-dialog {
    background: var(--bg-secondary);
    border-radius: var(--sns-border-radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    width: 480px;
    max-width: 92vw;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: slide-up-fade 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    .export-dialog-header {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        display: flex;
        align-items: center;
        justify-content: space-between;

        h3 {
            margin: 0;
            font-size: 16px;
            font-weight: 700;
            color: var(--text-primary);
        }

        .close-btn {
            background: none;
            border: none;
            color: var(--text-tertiary);
            cursor: pointer;
            padding: 6px;
            border-radius: 6px;
            display: flex;

            &:hover {
                background: var(--bg-primary);
                color: var(--text-primary);
            }

            &:disabled {
                opacity: 0.4;
                cursor: not-allowed;
            }
        }
    }

    .export-dialog-body {
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 18px;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
    }
}

.export-filter-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);

    .filter-badge {
        font-size: 12px;
        font-weight: 600;
        color: #fff;
        background: var(--primary, #576b95);
        padding: 2px 8px;
        border-radius: 10px;
    }

    .filter-tag {
        font-size: 13px;
        color: var(--text-secondary);
        background: var(--bg-primary);
        padding: 2px 10px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        gap: 4px;

        svg {
            flex-shrink: 0;
        }

        .sync-hint {
            font-size: 11px;
            color: var(--text-tertiary);
            font-style: italic;
        }
    }
}

.export-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.time-range-trigger.sns-export-time-range-trigger {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 12px;
    min-height: 32px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;

    &:hover:not(:disabled) {
        border-color: rgba(var(--primary-rgb), 0.45);
        color: var(--primary);
    }

    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .time-range-arrow {
        color: var(--text-tertiary);
        font-weight: 700;
        line-height: 1;
    }
}


.export-format-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    .format-option {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 14px 10px;
        border-radius: 10px;
        border: 2px solid var(--border-color);
        background: var(--bg-primary);
        cursor: pointer;
        transition: all 0.2s;

        span {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
        }

        small {
            font-size: 11px;
            color: var(--text-tertiary);
        }

        svg {
            color: var(--text-tertiary);
        }

        &:hover:not(:disabled) {
            border-color: var(--primary, #576b95);
            background: var(--bg-tertiary);
        }

        &.active {
            border-color: var(--primary, #576b95);
            background: rgba(87, 107, 149, 0.08);

            svg {
                color: var(--primary, #576b95);
            }
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }
}

.export-path-row {
    display: flex;
    gap: 8px;

    .export-path-input {
        flex: 1;
        padding: 8px 12px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background: var(--bg-primary);
        color: var(--text-primary);
        font-size: 13px;
        outline: none;
        cursor: default;

        &::placeholder {
            color: var(--text-tertiary);
        }
    }

    .export-browse-btn {
        padding: 8px 12px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        transition: all 0.15s;

        &:hover:not(:disabled) {
            background: var(--primary, #576b95);
            color: #fff;
            border-color: var(--primary, #576b95);
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }
}

.export-date-row {
    display: flex;
    align-items: center;
    gap: 8px;

    .date-picker-trigger {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background: var(--bg-primary);
        color: var(--text-primary);
        font-size: 13px;
        cursor: pointer;
        transition: all 0.15s;
        min-height: 36px;

        &:hover {
            border-color: var(--primary, #576b95);
        }

        &>svg:first-child {
            color: var(--text-tertiary);
            flex-shrink: 0;
        }

        .placeholder {
            color: var(--text-tertiary);
        }

        .clear-date {
            margin-left: auto;
            color: var(--text-tertiary);
            cursor: pointer;
            border-radius: 50%;
            padding: 1px;

            &:hover {
                color: var(--text-primary);
                background: var(--bg-tertiary);
            }
        }
    }

    .date-separator {
        font-size: 13px;
        color: var(--text-tertiary);
        flex-shrink: 0;
    }
}

.calendar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    animation: fadeIn 0.2s ease-out;
}

.calendar-modal {
    background: var(--card-bg);
    width: 340px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    .calendar-header {
        padding: 18px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-color);

        .title-area {
            display: flex;
            align-items: center;
            gap: 10px;
            color: var(--text-primary);

            svg {
                color: var(--primary);
            }

            h3 {
                font-size: 16px;
                font-weight: 600;
                margin: 0;
            }
        }

        .close-btn {
            background: none;
            border: none;
            color: var(--text-tertiary);
            cursor: pointer;
            padding: 4px;
            border-radius: 6px;
            display: flex;
            transition: all 0.2s;

            &:hover {
                background: var(--bg-hover);
                color: var(--text-primary);
            }
        }
    }

    .calendar-view {
        padding: 20px;

        .calendar-nav {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;

            .current-month {
                font-size: 15px;
                font-weight: 600;
                color: var(--text-primary);

                &.clickable {
                    cursor: pointer;
                    border-radius: 6px;
                    padding: 2px 8px;
                    transition: all 0.15s;

                    &:hover {
                        background: var(--bg-hover);
                        color: var(--primary);
                    }
                }
            }

            .nav-btn {
                width: 32px;
                height: 32px;
                display: flex;
                align-items: center;
                justify-content: center;
                background: var(--bg-secondary);
                border: 1px solid var(--border-color);
                border-radius: 8px;
                color: var(--text-secondary);
                cursor: pointer;
                transition: all 0.2s;

                &:hover {
                    background: var(--bg-hover);
                    border-color: var(--primary);
                    color: var(--primary);
                }
            }
        }

        .calendar-weekdays {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            margin-bottom: 8px;

            .weekday {
                text-align: center;
                font-size: 12px;
                font-weight: 500;
                color: var(--text-tertiary);
                padding: 4px 0;
            }
        }

        .calendar-days {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            grid-template-rows: repeat(6, 36px);
            gap: 4px;

            .day-cell {
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 14px;
                color: var(--text-primary);
                border-radius: 8px;
                cursor: pointer;
                transition: all 0.2s;
                position: relative;

                &.empty {
                    cursor: default;
                }

                &:not(.empty):hover {
                    background: var(--bg-hover);
                }

                &.selected {
                    background: var(--primary);
                    color: #fff;
                    font-weight: 600;
                }

                &.today:not(.selected) {
                    color: var(--primary);
                    font-weight: 600;
                    background: var(--primary-light);
                }
            }
        }

        .year-month-picker {
            padding: 4px 0;

            .year-selector {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 12px;

                .year-label {
                    font-size: 15px;
                    font-weight: 600;
                    color: var(--text-primary);
                }

                .nav-btn {
                    width: 32px;
                    height: 32px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    background: var(--bg-secondary);
                    border: 1px solid var(--border-color);
                    border-radius: 8px;
                    color: var(--text-secondary);
                    cursor: pointer;
                    transition: all 0.2s;

                    &:hover {
                        background: var(--bg-hover);
                        border-color: var(--primary);
                        color: var(--primary);
                    }
                }
            }

            .month-grid {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 6px;

                .month-btn {
                    padding: 10px 0;
                    border: none;
                    background: transparent;
                    border-radius: 8px;
                    cursor: pointer;
                    font-size: 13px;
                    color: var(--text-secondary);
                    transition: all 0.15s;

                    &:hover {
                        background: var(--bg-hover);
                        color: var(--text-primary);
                    }

                    &.active {
                        background: var(--primary);
                        color: #fff;
                    }
                }
            }
        }
    }

    .quick-options {
        display: flex;
        gap: 8px;
        padding: 0 20px 16px;

        button {
            flex: 1;
            padding: 8px;
            font-size: 12px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;

            &:hover {
                background: var(--bg-hover);
                color: var(--primary);
                border-color: var(--primary);
            }
        }
    }

    .dialog-footer {
        padding: 16px 20px;
        display: flex;
        gap: 12px;
        background: var(--bg-secondary);

        button {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .cancel-btn {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);

            &:hover {
                background: var(--bg-hover);
                color: var(--text-primary);
            }
        }
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;

    svg {
        flex-shrink: 0;
    }
}

.export-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .toggle-label {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        color: var(--text-primary);

        svg {
            color: var(--text-tertiary);
        }
    }

    .toggle-switch {
        width: 44px;
        height: 24px;
        border-radius: 12px;
        border: none;
        background: var(--bg-tertiary, #555);
        cursor: pointer;
        position: relative;
        transition: background 0.25s;
        padding: 0;
        flex-shrink: 0;

        &.active {
            background: var(--primary, #576b95);
        }

        .toggle-knob {
            position: absolute;
            top: 2px;
            left: 2px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #fff;
            transition: transform 0.25s;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }

        &.active .toggle-knob {
            transform: translateX(20px);
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }
}

.export-media-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.4;
}

.export-media-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;

    label {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: var(--text-primary);
        padding: 8px 10px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-secondary);
    }

    input[type='checkbox'] {
        margin: 0;
    }
}

.export-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;

    .export-progress-bar {
        height: 6px;
        background: var(--bg-tertiary);
        border-radius: 3px;
        overflow: hidden;

        .export-progress-fill {
            height: 100%;
            background: var(--primary, #576b95);
            border-radius: 3px;
            transition: width 0.3s ease;
        }
    }

    .export-progress-text {
        font-size: 12px;
        color: var(--text-tertiary);
        text-align: center;
    }

    .export-progress-actions {
        display: flex;
        justify-content: center;
        gap: 8px;
        flex-wrap: wrap;
        margin-top: 4px;
    }

    .export-progress-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 82px;
        height: 32px;
        padding: 0 12px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        background: var(--bg-secondary);
        color: var(--text-secondary);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;

        &:hover:not(:disabled) {
            background: var(--bg-hover);
            color: var(--text-primary);
        }

        &.primary {
            border-color: color-mix(in srgb, var(--primary) 36%, var(--border-color));
            background: rgba(var(--primary-rgb), 0.1);
            color: var(--primary);
        }

        &.danger {
            border-color: color-mix(in srgb, #ff4d4f 36%, var(--border-color));
            background: color-mix(in srgb, #ff4d4f 10%, var(--bg-secondary));
            color: #d9363e;
        }

        &:disabled {
            opacity: 0.55;
            cursor: not-allowed;
        }
    }
}

.export-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 10px 0;

    .export-result-icon {
        &.success svg {
            color: #52c41a;
        }

        &.error svg {
            color: #ff4d4f;
        }
    }

    h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
    }

    p {
        margin: 0;
        font-size: 14px;
        color: var(--text-secondary);
        line-height: 1.5;

        &.error-text {
            color: #ff4d4f;
            word-break: break-all;
        }
    }

    .export-result-actions {
        display: flex;
        gap: 10px;
        margin-top: 8px;
    }

    .export-open-btn,
    .export-done-btn {
        padding: 8px 20px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        border: none;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: all 0.15s;
    }

    .export-open-btn {
        background: var(--bg-tertiary);
        color: var(--text-primary);
        border: 1px solid var(--border-color);

        &:hover {
            background: var(--bg-primary);
        }
    }

    .export-done-btn {
        background: var(--primary, #576b95);
        color: #fff;

        &:hover {
            filter: brightness(1.1);
        }
    }
}

.export-sync-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin: 8px 0;
    color: var(--text-tertiary);
    font-size: 12px;
    border: 1px dashed var(--border-color);

    svg {
        color: var(--primary);
        flex-shrink: 0;
    }
}

.export-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;

    button {
        flex: 1;
        height: 40px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .export-cancel-btn {
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        color: var(--text-secondary);

        &:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
        }

        &:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }

    .export-start-btn {
        background: var(--primary, #576b95);
        border: none;
        color: #fff;
        box-shadow: 0 4px 12px rgba(87, 107, 149, 0.2);

        &:hover:not(:disabled) {
            filter: brightness(1.1);
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(87, 107, 149, 0.3);
        }

        &:active:not(:disabled) {
            transform: translateY(0);
        }

        &:disabled {
            background: var(--bg-tertiary);
            color: var(--text-tertiary);
            box-shadow: none;
            cursor: not-allowed;
        }
    }
}
