.gdi-wrap .gdi-preview-rendered {
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 24px 32px;
    margin: 12px 0 24px;
    max-width: 900px;
    border-radius: 4px;
}

.gdi-wrap .gdi-preview-rendered h2 {
    margin-top: 1.4em;
}

.gdi-wrap .gdi-preview-rendered img {
    max-width: 100%;
    height: auto;
}

.gdi-wrap textarea.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    background: #1d2327;
    color: #e6e6e6;
    border-color: #1d2327;
}

/* Author autocomplete widget */
.gdi-ac {
    position: relative;
    max-width: 400px;
}
.gdi-ac-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.gdi-ac-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 16px;
    font-size: 13px;
}
.gdi-ac-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}
.gdi-ac-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #757575;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
.gdi-ac-chip-remove:hover { color: #d63638; }

.gdi-ac-input {
    width: 100%;
}
.gdi-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.gdi-ac-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f1;
}
.gdi-ac-option:hover { background: #f6f7f7; }
.gdi-ac-option:last-child { border-bottom: none; }
.gdi-ac-option img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.gdi-ac-option-label {
    flex: 1;
    font-weight: 500;
}
.gdi-ac-option-meta {
    font-size: 11px;
    color: #757575;
}
.gdi-ac-empty {
    padding: 12px;
    color: #757575;
    text-align: center;
}

/* Internal link card preview */
.wp-block-gdi-internal-link-card {
    margin: 1.5em 0;
}
.gdi-card-link {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s ease, border-color .15s ease;
    background: #fff;
}
.gdi-card-link:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.gdi-card-thumb {
    flex: 0 0 120px;
    width: 120px;
    height: 120px;
    overflow: hidden;
    border-radius: 6px;
    background: #f0f0f1;
}
.gdi-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gdi-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.gdi-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
    color: #1d2327;
}
.gdi-card-excerpt {
    font-size: 14px;
    color: #50575e;
    margin: 0 0 10px;
    line-height: 1.45;
}
.gdi-card-cta {
    font-size: 13px;
    color: #2271b1;
    font-weight: 500;
}
.gdi-card-cta::before { content: '» '; }

@media (max-width: 600px) {
    .gdi-card-link { flex-direction: column; }
    .gdi-card-thumb { width: 100%; height: 180px; flex: 0 0 180px; }
}

/* Содержание (gdi/toc) — стилизация под Elementor table-of-contents widget */
.wp-block-gdi-toc {
    margin: 1.5em 0 2em;
    padding: 20px 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafbfc;
}
.wp-block-gdi-toc .gdi-toc__title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #121a2a;
    line-height: 1.3;
}
.wp-block-gdi-toc .gdi-toc__list,
.wp-block-gdi-toc .gdi-toc__sublist {
    margin: 0;
    padding-left: 24px;
    list-style: decimal outside;
}
.wp-block-gdi-toc .gdi-toc__sublist {
    margin-top: 4px;
    padding-left: 28px;
    list-style-type: decimal;
}
.wp-block-gdi-toc .gdi-toc__item {
    margin: 4px 0;
    line-height: 1.5;
    font-size: 15px;
}
.wp-block-gdi-toc .gdi-toc__item--sub {
    font-size: 14px;
    color: #50575e;
}
.wp-block-gdi-toc .gdi-toc__link {
    color: #4779bc;
    text-decoration: none;
    transition: color .15s ease;
}
.wp-block-gdi-toc .gdi-toc__link:hover {
    color: #1d4f8a;
    text-decoration: underline;
}
.gdi-toc-placeholder {
    padding: 16px;
    border: 1px dashed #c3c4c7;
    border-radius: 6px;
    color: #757575;
    font-style: italic;
}

/* Smooth-scroll к якорям + offset под фиксированный header темы */
html { scroll-behavior: smooth; }
.wp-block-heading[id] { scroll-margin-top: 80px; }

/* Editor-only: карточка должна вписываться в контентную колонку,
   не вылезая за её поля и не получая negative-margin от темы. */
.editor-styles-wrapper .wp-block-gdi-internal-link-card,
.block-editor-block-list__block.wp-block-gdi-internal-link-card,
.wp-block.wp-block-gdi-internal-link-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.editor-styles-wrapper .wp-block-gdi-internal-link-card .gdi-card-link,
.block-editor-block-list__block.wp-block-gdi-internal-link-card .gdi-card-link {
    box-sizing: border-box;
    max-width: 100%;
}

/* Progress overlay */
.gdi-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,20,28,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.gdi-overlay-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    width: 100%;
    max-width: 540px;
    box-shadow: 0 18px 56px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.gdi-overlay-title {
    margin: 0;
    font-size: 18px;
    color: #1d2327;
}
.gdi-progress {
    width: 100%;
    height: 8px;
    background: #f0f0f1;
    border-radius: 999px;
    overflow: hidden;
}
.gdi-progress-bar {
    height: 100%;
    background: #2271b1;
    transition: width .3s ease, background .2s ease;
    width: 0;
}
.gdi-progress-bar.is-done { background: #00a32a; }
.gdi-progress-bar.is-error { background: #d63638; }
.gdi-overlay-stage {
    font-size: 14px;
    color: #50575e;
    min-height: 20px;
}
.gdi-overlay-log {
    margin: 0;
    padding: 8px 12px;
    list-style: none;
    background: #f6f7f7;
    border-radius: 4px;
    max-height: 140px;
    overflow-y: auto;
    font-size: 12px;
    color: #50575e;
}
.gdi-overlay-log li {
    padding: 2px 0;
    border-bottom: 1px solid #ebebeb;
}
.gdi-overlay-log li:last-child {
    border-bottom: 0;
    color: #1d2327;
    font-weight: 500;
}
.gdi-overlay-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Author guide page */
.gdi-guide-grid { display: grid; gap: 18px; grid-template-columns: 1fr; max-width: 880px; }
@media (min-width: 900px) {
    .gdi-guide-grid { grid-template-columns: 1fr 1fr; }
}
.gdi-guide-section {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 18px 20px;
}
.gdi-guide-section h2 {
    margin-top: 0;
    font-size: 16px;
    color: #2271b1;
}
.gdi-guide-section ul, .gdi-guide-section ol {
    margin: 8px 0 0 18px;
}
.gdi-guide-section li { margin-bottom: 4px; }
.gdi-good { color: #00a32a; font-weight: 600; }
.gdi-bad  { color: #d63638; font-weight: 600; }
