.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #eef2ec;
    border: 1px solid #cad8c3;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
}

.editor-toolbar-button {
    display: inline-block;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #cad8c3;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2a1f;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}

.editor-toolbar-button:hover {
    background: #008c36;
    color: #ffffff;
}

.editor-storage {
    display: none !important;
}

.rich-editor {
    width: 100%;
    min-height: 430px;
    padding: 18px;
    border: 1px solid #cad8c3;
    border-radius: 0 0 10px 10px;
    background: #ffffff;
    color: #1f2a1f;
    font-size: 17px;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
}

.rich-editor:focus {
    border-color: #008c36;
    box-shadow: 0 0 0 3px rgba(0, 140, 54, 0.18);
}

.rich-editor p {
    margin: 0 0 16px 0;
}

.editor-image {
    position: relative;
    display: block;
    max-width: 620px;
    margin: 18px auto;
    padding: 10px;
    background: #eef4ea;
    border: 1px solid #cad8c3;
    border-radius: 14px;
    text-align: center;
}

.editor-image img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
}

.editor-image figcaption {
    margin-top: 8px;
    color: #53604f;
    font-size: 14px;
    font-weight: 700;
}

.editor-image-tools {
    position: absolute;
    top: 10px;
    right: 10px;
}

.editor-image-remove {
    display: inline-block;
    padding: 5px 9px;
    border: 0;
    border-radius: 999px;
    background: rgba(122, 21, 21, 0.94);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.editor-image-remove:hover {
    background: #a51d1d;
}

.media-modal[hidden] {
    display: none;
}

.media-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(31, 42, 31, 0.66);
}

.media-modal-dialog {
    position: relative;
    width: calc(100% - 36px);
    max-width: 1080px;
    max-height: calc(100vh - 60px);
    margin: 30px auto;
    padding: 26px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.media-modal-header h2 {
    margin: 0;
    color: #008c36;
    font-size: 30px;
    line-height: 1.2;
}

.media-modal-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: #1f2a1f;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.media-modal-close:hover {
    background: #008c36;
}

.media-modal-search {
    margin-bottom: 18px;
}

.media-modal-search label {
    display: block;
    margin-bottom: 7px;
    font-weight: 900;
}

.media-modal-search input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cad8c3;
    border-radius: 10px;
    font-size: 16px;
}

.media-modal-search input:focus {
    outline: 3px solid rgba(0, 140, 54, 0.18);
    border-color: #008c36;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.media-thumb {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px solid #d9e4d2;
    border-radius: 14px;
    background: #ffffff;
    color: #1f2a1f;
    text-align: left;
    cursor: pointer;
}

.media-thumb:hover,
.media-thumb:focus {
    border-color: #008c36;
    box-shadow: 0 0 0 3px rgba(0, 140, 54, 0.15);
    outline: none;
}

.media-thumb-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    margin-bottom: 9px;
    background: #eef2ec;
    border-radius: 10px;
    overflow: hidden;
}

.media-thumb-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb-title {
    display: block;
    color: #1f2a1f;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: break-word;
}

.media-thumb-folder {
    display: block;
    margin-top: 4px;
    color: #6f7b6b;
    font-size: 12px;
    font-weight: 700;
}

.media-empty {
    padding: 20px;
    background: #eef2ec;
    border: 1px solid #cad8c3;
    border-radius: 12px;
}

@media screen and (max-width: 980px) {
    .media-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media screen and (max-width: 760px) {
    .media-modal-dialog {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        margin: 10px auto;
        padding: 18px;
        border-radius: 14px;
    }

    .media-modal-header h2 {
        font-size: 24px;
    }

    .media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .rich-editor {
        min-height: 360px;
        font-size: 16px;
    }

    .editor-image {
        max-width: 100%;
    }
}

@media screen and (max-width: 420px) {
    .media-grid {
        grid-template-columns: 1fr;
    }
}