/* Compact Summernote item-description widget. */
.rte-field {
    min-width: 200px;
}

/* Shrink Summernote's chrome to fit inside a dense table cell. */
.rte-field .note-editor.note-frame {
    margin-bottom: 0;
}

.rte-field .note-editor .note-toolbar {
    padding: 2px 4px;
    font-size: 11px;
}

.rte-field .note-editor .note-editing-area .note-editable {
    padding: 4px 6px;
    /* Match dompdf constraints: wrap long tokens so a cell can't blow out. */
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Keep the toolbar compact but let its groups wrap on a narrow cell. */
.rte-field .note-editor .note-toolbar {
    display: flex;
    flex-wrap: wrap;
}

.rte-field .note-editable ul,
.rte-field .note-editable ol {
    margin: 0;
    padding-left: 18px;
}

/* Tables authored in the editor: readable + bounded so they can't blow out
   the column (mirrors the dompdf constraints applied at render time). */
.rte-field .note-editable table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.rte-field .note-editable table td,
.rte-field .note-editable table th {
    border: 1px solid #ced4da;
    padding: 2px 4px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.rte-field .note-editable blockquote {
    border-left: 3px solid #ced4da;
    margin: 4px 0;
    padding-left: 8px;
    color: #6c757d;
}

.rte-field .note-editable pre {
    background: #f6f8fa;
    padding: 4px 6px;
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Fallback plain box when Summernote isn't loaded on a page. */
.rte-field .rte-summernote[contenteditable] {
    min-height: 34px;
    max-height: 160px;
    overflow-y: auto;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
