._dash-loading {
    color: transparent;
    position: fixed;
    width: 46px;
    height: 46px;
    top: 50vh;
    left: 50vw;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    border: 4px solid #e8eef8;
    border-top-color: #1677ff;
    border-radius: 50%;
    animation: dashgo-loading-spin 0.8s linear infinite;
}

._dash-loading::after {
    content: '';
}

@keyframes dashgo-loading-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.ai-workbench-page {
    min-height: 100%;
    padding: 18px;
    background: #f4f6fa;
    color: #172033;
}

.ai-workbench-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.ai-workbench-heading,
.ai-workbench-actions,
.ai-workbench-meta-tags {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-workbench-heading h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.ai-workbench-subtitle,
.ai-workbench-source,
.ai-workbench-image-summary {
    color: #7d8798;
    font-size: 13px;
}

.ai-workbench-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

#ai-workbench-message:empty {
    display: none;
}

#ai-workbench-message {
    margin-bottom: 14px;
}

.ai-workbench-grid {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.6fr) minmax(340px, 1fr);
    gap: 14px;
    align-items: start;
}

.ai-workbench-column {
    min-width: 0;
}

.ai-workbench-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-workbench-card,
.ai-workbench-main-card,
.ai-workbench-preview-card,
.ai-workbench-source-collapse {
    border-radius: 12px !important;
    overflow: hidden;
}

.ai-workbench-main-card > .ant-card-body,
.ai-workbench-preview-card > .ant-card-body {
    padding: 14px;
}

.ai-workbench-layout-frame {
    width: 100%;
    height: calc(100vh - 255px);
    min-height: 620px;
    border: 1px solid #e7eaf0;
    border-radius: 10px;
    background: #fff;
}

.ai-workbench-field-with-actions {
    width: 100%;
}

/* Draft list: keep batch context visible while previewing one full article. */
.ai-draft-list-preview-drawer .ant-drawer-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    overflow-x: hidden;
    background: radial-gradient(circle at 50% 12%, #f2f6ff, #e9edf5 68%);
}

.ai-draft-list-preview-phone {
    position: relative;
    box-sizing: border-box;
    width: 390px;
    max-width: 100%;
    padding: 14px;
    border: 8px solid #1c2433;
    border-radius: 36px;
    background: #1c2433;
    box-shadow: 0 18px 42px rgba(24, 36, 58, .22);
}

.ai-draft-list-preview-phone::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    left: 50%;
    width: 104px;
    height: 22px;
    transform: translateX(-50%);
    border-radius: 0 0 14px 14px;
    background: #1c2433;
}

.ai-draft-list-preview-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 560px;
    border: 0;
    border-radius: 22px;
    background: #fff;
}

.ai-draft-list-preview-help {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 12px;
}

.ai-draft-toolbar-card > .ant-card-body {
    padding: 18px 20px;
}

.ai-draft-filter-grid {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(120px, .8fr) minmax(230px, 1.35fr) minmax(170px, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.ai-draft-filter-grid--admin {
    grid-template-columns: minmax(130px, 1fr) minmax(120px, .8fr) minmax(230px, 1.35fr) minmax(130px, .8fr) minmax(170px, 1fr) auto;
}

.ai-draft-filter-category-nav {
    grid-column: 1 / -1;
    min-width: 0;
}

.ai-draft-batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-draft-batch-assign-group,
.ai-draft-batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#ai-draft-selection-summary {
    min-width: 72px;
    color: #1677ff;
}

@media (max-width: 1200px) {
    .ai-draft-filter-grid,
    .ai-draft-filter-grid--admin {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .ai-draft-filter-grid,
    .ai-draft-filter-grid--admin {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ai-draft-batch-toolbar,
    .ai-draft-batch-assign-group,
    .ai-draft-batch-actions {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .ai-draft-filter-grid,
    .ai-draft-filter-grid--admin {
        grid-template-columns: 1fr;
    }

    .ai-draft-batch-assign-group,
    .ai-draft-batch-actions {
        align-items: stretch;
        flex-direction: column;
    }

    #ai-draft-batch-account {
        width: 100% !important;
    }

    .ai-draft-list-preview-drawer .ant-drawer-content-wrapper {
        width: 100% !important;
    }

    .ai-draft-list-preview-drawer .ant-drawer-body {
        padding: 14px 12px;
    }

    .ai-draft-list-preview-frame {
        min-height: 520px;
    }
}

.ai-workbench-text-count {
    margin-top: 6px;
    color: #7d8798;
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
}

.ai-workbench-text-count.is-warning {
    color: #d48806;
}

.ai-workbench-text-count.is-error {
    color: #cf1322;
    font-weight: 600;
}

.ai-workbench-field-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.ai-workbench-template-control {
    width: 100%;
}

.ai-workbench-template-help {
    margin-top: 6px;
    color: #7d8798;
    font-size: 12px;
    line-height: 1.45;
}

.ai-workbench-theme-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-workbench-editor-pane {
    width: 100%;
}

.ai-workbench-editor-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    background: #f8fafc;
}

.ai-workbench-editor-toolbar-meta,
.ai-workbench-editor-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-workbench-ai-error {
    color: #d4380d;
    font-size: 12px;
}

.ai-workbench-rich-editor {
    width: 100%;
    min-height: 680px;
    overflow: hidden;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    background: #fff;
}

.ai-workbench-rich-editor .w-e-text-container {
    min-height: 620px !important;
}

.ai-workbench-rich-editor .w-e-text-placeholder {
    top: 14px;
}

.ai-workbench-preview {
    position: sticky;
    top: 12px;
}

.ai-workbench-preview-card .ant-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.ai-workbench-preview-shell {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 13px;
    border: 8px solid #1c2433;
    border-radius: 34px;
    background: #1c2433;
    transition: width .2s ease;
}

.ai-workbench-preview-shell.is-phone {
    width: 390px;
}

.ai-workbench-preview-shell.is-desktop {
    width: 100%;
    border-width: 5px;
    border-radius: 18px;
}

.ai-workbench-preview-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 305px);
    min-height: 570px;
    border: 0;
    border-radius: 20px;
    background: #fff;
}

.ai-workbench-preview-shell.is-desktop .ai-workbench-preview-frame {
    border-radius: 12px;
}

.ai-workbench-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ai-workbench-image-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #d9e7f7;
    border-radius: 10px;
    background: #f4f9ff;
}

.ai-workbench-image-tip {
    color: #53657d;
    font-size: 13px;
    line-height: 1.5;
}

.ai-workbench-decorative-collapse {
    margin-top: 14px;
}

.ai-workbench-decorative-list {
    display: grid;
    gap: 8px;
}

.ai-workbench-decorative-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #fafbfc;
}

.ai-workbench-decorative-thumb {
    width: 64px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.ai-workbench-decorative-size {
    color: #172033;
    font-weight: 600;
}

.ai-workbench-decorative-reason {
    margin-top: 2px;
    color: #7a8497;
    font-size: 12px;
}

.ai-workbench-image-card {
    height: 100%;
    border-radius: 10px !important;
}

.ai-workbench-image-wrap {
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin-bottom: 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #eaf0f8, #dbe4f0);
}

.ai-workbench-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-workbench-image-prompt {
    min-height: 40px;
    margin-bottom: 10px;
    color: #687286;
    font-size: 13px;
    line-height: 1.5;
}

.ai-workbench-cover-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-workbench-image-strategy .ant-radio-button-wrapper {
    min-width: 0;
    padding-inline: 6px;
    white-space: nowrap;
    text-align: center;
}

.ai-workbench-image-error {
    margin-top: 8px;
    color: #d4380d;
    font-size: 12px;
}

.ai-workbench-cover-crop-modal .ant-modal-body {
    padding-top: 16px;
}

.ai-workbench-cover-crop-help {
    margin-bottom: 12px;
    color: #687286;
    font-size: 13px;
    line-height: 1.5;
}

.ai-workbench-cover-crop-preview {
    overflow: hidden;
    min-height: 430px;
    border-radius: 10px;
    background: #101828;
}

.ai-workbench-cover-crop-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

@media (max-width: 1500px) {
    .ai-workbench-grid {
        grid-template-columns: minmax(250px, .75fr) minmax(480px, 1.45fr) minmax(320px, .9fr);
    }

    .ai-workbench-image-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .ai-workbench-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .ai-workbench-actions {
        justify-content: flex-start;
    }

    .ai-workbench-grid {
        display: flex;
        flex-direction: column;
    }

    .ai-workbench-layout {
        order: 1;
        width: 100%;
    }

    .ai-workbench-preview {
        position: static;
        order: 2;
        width: 100%;
    }

    .ai-workbench-settings {
        order: 3;
        width: 100%;
    }

    .ai-workbench-image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .ai-workbench-page {
        padding: 10px;
    }

    .ai-workbench-heading {
        align-items: flex-start;
    }

    .ai-workbench-heading h2 {
        font-size: 20px;
    }

    .ai-workbench-image-grid {
        grid-template-columns: 1fr;
    }

    .ai-workbench-preview-shell.is-phone {
        width: 100%;
    }
}

.ai-category-nav {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.ai-category-nav__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.ai-category-nav__label {
    flex: 0 0 92px;
    box-sizing: border-box;
    padding: 4px 8px;
    border: 1px solid #ff4d4f;
    border-radius: 4px;
    color: #8c8c8c;
    text-align: center;
    overflow-wrap: normal;
    white-space: nowrap;
}

.ai-category-nav__items {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 4px 12px;
    min-width: 0;
    max-width: 100%;
}

.ai-category-nav__item {
    max-width: 100%;
    padding: 4px 6px;
    overflow-wrap: normal;
    border: 0;
    background: transparent;
    color: #262626;
    white-space: nowrap;
    cursor: pointer;
}

.ai-category-nav__item--active {
    border-radius: 4px;
    background: #e6f4ff;
    color: #1677ff;
    font-weight: 600;
}

.ai-category-nav__add,
.ai-category-nav__empty {
    max-width: 100%;
    padding: 4px 6px;
    overflow-wrap: normal;
    white-space: nowrap;
}

.ai-category-nav__add {
    color: #1677ff;
    text-decoration: none;
}

.ai-category-nav__empty {
    color: #8c8c8c;
}

@media (max-width: 576px) {
    .ai-category-nav__row {
        flex-direction: column;
        gap: 4px;
    }

    .ai-category-nav__label {
        flex-basis: auto;
        width: 92px;
    }
}
