/* KBoard native editor: uses the forum's light and dark palette. */
.native-editor {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    min-width: 0;
}
.native-editor [hidden] {
    display: none !important;
}
.native-editor-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}
.native-editor-modes button,
.native-editor-toolbar button {
    min-height: 36px;
    min-width: 36px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    padding: 6px 9px;
    font: inherit;
    font-size: 13px;
}
.native-editor-modes button[aria-pressed="true"],
.native-editor-toolbar button[aria-pressed="true"] {
    color: var(--on-primary, #fff);
    background: var(--blue);
}
.native-editor-modes button:hover,
.native-editor-toolbar button:hover {
    border-color: var(--border);
    background: var(--blue-soft);
    color: var(--text);
}
.native-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    padding: 6px;
    border-bottom: 1px solid var(--border);
}
.native-editor-toolbar [data-native-command="bold"] {
    font-weight: 800;
}
.native-editor-toolbar [data-native-command="italic"] {
    font-style: italic;
}
.native-editor-toolbar [data-native-command="underline"] {
    text-decoration: underline;
}
.native-editor-toolbar [data-native-command="strike"] {
    text-decoration: line-through;
}
.native-editor-toolbar button:disabled {
    opacity: 0.4;
    cursor: default;
}
.native-editor button:focus-visible,
.native-editor select:focus-visible,
.native-editor input:focus-visible {
    outline: 2px solid var(--focus, var(--blue));
    outline-offset: 2px;
}
.native-editor-block-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
}
.native-editor-block-label select {
    padding: 6px;
    min-height: 36px;
    max-width: 130px;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
}
.native-editor-visual {
    min-height: 210px;
    max-height: 650px;
    overflow: auto;
    padding: 18px;
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    outline: none;
}
.native-editor-visual:focus {
    box-shadow: inset 0 0 0 2px var(--focus, var(--blue));
}
.native-editor-visual p {
    margin: 0 0 12px;
}
.native-editor-visual p:last-child {
    margin-bottom: 0;
}
.native-editor-visual[data-empty="true"]::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    color: var(--muted);
    pointer-events: none;
}
.native-editor-visual img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}
.native-editor-visual table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    margin: 12px 0;
}
.native-editor-visual td,
.native-editor-visual th {
    border: 1px solid var(--border);
    min-width: 50px;
    padding: 8px;
    overflow-wrap: anywhere;
}
.native-editor-visual th {
    background: var(--surface-alt);
}
.native-editor-visual pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.composer .native-editor-source {
    display: block;
    width: 100%;
    min-height: 260px;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    padding: 18px;
    resize: vertical;
}
.native-editor-status {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}
.native-editor-preview {
    border-top: 1px solid var(--border);
    padding: 18px;
    max-height: 500px;
    overflow: auto;
}
.native-editor-dialog {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}
.native-editor-dialog label {
    display: grid;
    gap: 5px;
    font-size: 13px;
}
.native-editor-dialog input,
.native-editor-dialog select,
.native-editor-dialog textarea {
    width: 100%;
    min-width: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 8px;
    font: inherit;
}
.native-editor-dialog input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
.native-editor-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.native-editor-dialog-actions .button {
    min-height: 38px;
}
@media (max-width: 600px) {
    .native-editor-toolbar {
        gap: 2px;
        padding: 5px;
    }
    .native-editor-toolbar button {
        min-height: 38px;
        min-width: 36px;
        padding: 6px;
        font-size: 12px;
    }
    .native-editor-block-label {
        margin: 0;
    }
    .native-editor-block-label select {
        max-width: 120px;
    }
    .native-editor-visual {
        min-height: 190px;
        padding: 13px;
        font-size: 16px;
    }
    .composer .native-editor-source {
        font-size: 16px;
        padding: 13px;
    }
}
