
:root {
    --sun-bg: #0f172a; /* фон редактора */
    --sun-fg: #e5e7eb; /* базовый цвет текста */
    --sun-muted: #9ca3af; /* плейсхолдер/вторичный */
    --sun-brd: #334155; /* рамки */
    --sun-ui: #111827; /* тулбар/панели */
}

/* Корень SunEditor – добавим класс через JS: editor.core.container.classList.add('sun-dark') */
.sun-editor.sun-dark,
.sun-editor.sun-dark .se-container,
.sun-editor.sun-dark .se-toolbar,
.sun-editor.sun-dark .se-wrapper,
.sun-editor.sun-dark .se-wrapper-wysiwyg {
    background: var(--sun-bg);
    color: var(--sun-fg);
}

    /* Плейсхолдер */
    .sun-editor.sun-dark .se-wrapper .se-placeholder,
    .sun-editor.sun-dark .se-toolbar .se-btn-tooltip {
        color: var(--sun-muted);
    }

    /* Рамки/подпорки */
    .sun-editor.sun-dark,
    .sun-editor.sun-dark .se-toolbar,
    .sun-editor.sun-dark .se-wrapper,
    .sun-editor.sun-dark .se-resizing-bar {
        border-color: var(--sun-brd);
    }

        /* Тулбар/кнопки */
        .sun-editor.sun-dark .se-toolbar {
            background: var(--sun-ui);
        }

        .sun-editor.sun-dark .se-btn {
            color: var(--sun-fg);
        }

/* Адаптивность: редактор не должен «выпадать» за пределы контейнера */
.sun-editor,
.sun-editor .se-container,
.sun-editor .se-toolbar,
.sun-editor .se-wrapper,
.sun-editor .se-resizing-bar {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

    /* Контент внутри редактора — картинки/таблицы не выходят за край */
    .sun-editor .se-wrapper-wysiwyg img {
        max-width: 100%;
        height: auto;
    }

    .sun-editor .se-wrapper-wysiwyg table {
        max-width: 100%;
        display: block;
        overflow-x: auto;
    }

/* Плейсхолдер в textarea до инициализации (Bootstrap override) */
textarea.js-sun-editor::placeholder {
    color: var(--sun-muted);
    opacity: .9;
}













/* Контейнер редактора — не вылезает за пределы родителя */
.sun-editor, .sun-editor .se-container {
    max-width: 100%;
    width: 100% !important;
}

    .sun-editor .se-toolbar {
        overflow-x: auto;
    }

    /* Тёмная тема (минимально) */
    .sun-editor,
    .sun-editor .se-container,
    .sun-editor .se-toolbar,
    .sun-editor .se-menu-list,
    .sun-editor .se-dialog {
        background-color: var(--wenrexa-bg-secondary) !important;
        color: #e5e7eb !important;
        border-color: rgba(255,255,255,0.08) !important;
    }

        .sun-editor .se-btn-module-border,
        .sun-editor .se-toolbar,
        .sun-editor .se-toolbar-line,
        .sun-editor .se-dialog .se-dialog-inner {
            border-color: rgba(255,255,255,0.08) !important;
            overflow: hidden !important
        }

        /* Область редактирования */
        .sun-editor .se-wrapper,
        .sun-editor .se-wrapper .se-wrapper-inner {
            background-color: var(--wenrexa-bg-secondary) !important;
            color: #e5e7eb !important;
            min-height: 220px;
        }

        /* Подсказки/меню */
        .sun-editor .se-list-layer,
        .sun-editor .se-tooltip {
            background-color: var(--wenrexa-bg-secondary) !important;
            color: #e5e7eb !important;
            border-color: rgba(255,255,255,0.12) !important;
            border: 0px;
        }

        .sun-editor .se-toolbar {
            outline: 0;
        }

        .sun-editor .se-btn-tray {
            background: #0d0d0d;
        }

        .sun-editor .se-resizing-bar {
            background: rgba(255,255,255,0.0) !important;
            border-top: 1px solid #1f1f1f;
        }

        .sun-editor .se-btn:enabled:focus, .sun-editor .se-btn:enabled:hover {
            background-color: #e1e1e1;
            background: #2a3034 !important;
        }