.record-editor-page {
    border: 1px solid var(--line);
    border-radius: var(--panel-radius);
    background: var(--surface, #ffffff);
    min-width: 0;
}

.record-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.record-editor-header h3 {
    margin: 0;
    font-size: var(--ui-section-size, 1.2rem);
}

.record-editor-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.record-editor-header .modal-context {
    margin: 0;
    padding: 0;
}

.record-editor-header .modal-context > span {
    color: var(--green);
    font-size: 0.75rem;
}

.record-editor-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.record-editor-page .record-editor {
    display: grid;
    gap: 16px;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 16px;
    margin: 0;
    border: 0;
    border-radius: 0 0 var(--panel-radius) var(--panel-radius);
    box-shadow: none;
    background: transparent;
}

.record-editor label:not(.check) {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    min-width: 0;
}

.record-editor :is(input:not([type='checkbox']):not([type='radio']), select, textarea) {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--control-radius);
    min-height: var(--control-height);
    padding: 6px 12px;
    color: inherit;
    background: var(--surface, #fff);
    font: 400 14px/20px var(--font-ui);
}

.record-editor textarea {
    min-height: 100px;
    resize: vertical;
}

.record-editor fieldset {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
}

.record-editor > .modal-actions {
    position: static;
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--line);
    background: transparent;
    grid-column: 1 / -1;
}

.record-editor [hidden] {
    display: none !important;
}

.record-editor .searchable-select input {
    border: 0;
    background: transparent;
}

html[data-theme='dark'] .record-editor-page {
    background: var(--surface);
    color: var(--text);
}

html[data-theme='dark'] .record-editor-header .modal-context,
html[data-theme='dark'] .record-editor > .modal-actions {
    background: transparent;
}

html[data-theme='dark'] .record-editor-header .modal-context > span {
    color: var(--text-secondary);
}

html[data-theme='dark']
    .record-editor-page
    :is(.record-editor-back, .select-trigger, .row-action, button[data-close]) {
    background: var(--control-bg) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

@media (max-width: 600px) {
    .record-editor-header {
        padding: 12px;
        align-items: flex-start;
        gap: 10px;
    }

    .record-editor-header h3 {
        font-size: 1rem;
    }

    .record-editor-back {
        padding: 9px;
        font-size: 0.7rem;
    }

    .record-editor-page .record-editor {
        padding: 12px;
    }

    .record-editor :is(.workflow-meta, .role-identity) {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-editor .workflow-step-editor {
        grid-template-columns: 32px minmax(0, 1fr) 36px;
    }

    .record-editor .workflow-step-editor > :is(input, select, .searchable-select) {
        grid-column: 2;
    }

    .record-editor .workflow-step-editor > b {
        grid-column: 1;
        grid-row: 1;
    }

    .record-editor .workflow-step-editor > button {
        grid-column: 3;
        grid-row: 1;
    }
}

#pageHost .record-editor-header {
    border-radius: 13px 13px 0 0;
}

#pageHost .record-editor-page > :last-child {
    border-end-start-radius: 13px;
    border-end-end-radius: 13px;
}
