.rich-text-editor {
    overflow: hidden;
    border: 1px solid #d8e2dd;
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.rich-text-editor:focus-within {
    border-color: var(--green-700, #28634d);
    box-shadow: 0 0 0 3px rgba(40, 99, 77, .1);
}

.rich-text-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    min-height: 48px;
    padding: 6px 8px;
    border-bottom: 1px solid #e2e9e5;
    background: #f7faf8;
}

.rich-text-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 34px;
    padding: 0 6px;
    border-right: 1px solid #dde7e1;
}

.rich-text-toolbar-group:first-child {
    padding-left: 0;
}

.rich-text-toolbar-group:last-child {
    border-right: 0;
}

.rich-text-format-select {
    width: auto;
    min-width: 126px;
    height: 34px;
    padding: 0 30px 0 10px;
    border: 1px solid #d5e1db;
    border-radius: 8px;
    color: var(--ink, #10261f);
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.rich-text-format-select:focus-visible {
    border-color: var(--green-700, #28634d);
    outline: 2px solid rgba(40, 99, 77, .12);
    outline-offset: 1px;
}

.rich-text-toolbar button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink, #10261f);
    background: transparent;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

.rich-text-toolbar button:hover,
.rich-text-toolbar button:focus-visible,
.rich-text-toolbar button.is-active {
    border-color: #cbdad2;
    color: var(--green-800, #174f3c);
    background: #fff;
    outline: none;
}

.rich-text-toolbar button.is-active {
    border-color: #afc9bc;
    background: #eaf4ef;
}

.rich-text-toolbar button:disabled {
    opacity: .34;
    cursor: default;
}

.rich-text-toolbar button strong,
.rich-text-toolbar button em,
.rich-text-toolbar button u {
    font-size: 15px;
}

.rich-text-toolbar button.is-align-center span {
    transform: scaleX(.8);
}

.rich-text-toolbar button.is-align-right span {
    transform: scaleX(.65);
    transform-origin: right center;
}

.rich-text-table-icon {
    font-size: 18px;
}

.rich-text-code-icon {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.06em;
}

.rich-text-surface,
.rich-text-source-view {
    min-height: 190px;
    max-height: 520px;
    overflow-y: auto;
    padding: 15px 16px;
    color: var(--ink, #10261f);
    background: #fff;
    font-size: 14px;
    line-height: 1.65;
    outline: none;
}

.rich-text-source-view {
    display: block;
    width: 100%;
    resize: vertical;
    border: 0;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.55;
    tab-size: 2;
    white-space: pre-wrap;
}

.rich-text-source-view[hidden],
.rich-text-surface[hidden] {
    display: none !important;
}

.rich-text-editor.is-source-mode .rich-text-toolbar {
    background: #f1f5f3;
}

.rich-text-surface:empty::before {
    color: #8a9991;
    content: attr(data-placeholder);
    pointer-events: none;
}

.rich-text-surface p,
.rich-text-content p {
    margin: 0 0 12px;
}

.rich-text-surface p:last-child,
.rich-text-content p:last-child {
    margin-bottom: 0;
}

.rich-text-surface h2,
.rich-text-content h2,
.rich-text-surface h3,
.rich-text-content h3,
.rich-text-surface h4,
.rich-text-content h4 {
    margin: 1.25em 0 .55em;
    color: inherit;
    font-family: inherit;
    line-height: 1.18;
}

.rich-text-surface h2:first-child,
.rich-text-content h2:first-child,
.rich-text-surface h3:first-child,
.rich-text-content h3:first-child,
.rich-text-surface h4:first-child,
.rich-text-content h4:first-child {
    margin-top: 0;
}

.rich-text-surface h2,
.rich-text-content h2 {
    font-size: 1.65em;
    font-weight: 800;
}

.rich-text-surface h3,
.rich-text-content h3 {
    font-size: 1.35em;
    font-weight: 800;
}

.rich-text-surface h4,
.rich-text-content h4 {
    font-size: 1.12em;
    font-weight: 800;
}

.rich-text-surface ul,
.rich-text-surface ol,
.rich-text-content ul,
.rich-text-content ol {
    margin: 10px 0 14px;
    padding-left: 24px;
}

.rich-text-surface li + li,
.rich-text-content li + li {
    margin-top: 5px;
}

.rich-text-surface a,
.rich-text-content a {
    color: var(--green-700, #28634d);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: .08em;
    text-underline-offset: .16em;
}

.rich-text-surface table,
.rich-text-content table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    border-spacing: 0;
}

.rich-text-surface th,
.rich-text-surface td,
.rich-text-content th,
.rich-text-content td {
    min-width: 90px;
    padding: 9px 11px;
    border: 1px solid #d9e3de;
    text-align: left;
    vertical-align: top;
}

.rich-text-surface th,
.rich-text-content th {
    background: #f2f7f4;
    font-weight: 800;
}

.rich-text-surface .rt-align-center,
.rich-text-content .rt-align-center {
    text-align: center;
}

.rich-text-surface .rt-align-right,
.rich-text-content .rt-align-right {
    text-align: right;
}

.rich-text-surface .rt-align-justify,
.rich-text-content .rt-align-justify {
    text-align: justify;
}

.rich-text-content {
    line-height: 1.7;
}

.rich-text-content strong {
    color: inherit;
    font-weight: 700;
}

@media (max-width: 900px) {
    .rich-text-toolbar-group {
        padding: 0 4px;
    }

    .rich-text-format-select {
        min-width: 112px;
    }
}

@media (max-width: 640px) {
    .rich-text-toolbar {
        padding: 5px;
    }

    .rich-text-toolbar-group {
        border-right: 0;
    }

    .rich-text-surface,
    .rich-text-source-view {
        min-height: 160px;
        padding: 12px;
    }
}
