input[type=file] {
    height: auto !important;
}

.file-upload.widgeted {
    padding: 10px;
    background-color: #e0e0e0;
    border-radius: 8px;
}

.file-upload h3 {
    font-family: 'Roboto', sans-serif;
    font-weight: 200 !important;
    font-size: 2em !important;
}

.file-upload h4 {
    font-family: 'Roboto', sans-serif;
    font-weight: 600 !important;
    font-size: 1.5em !important;
}

.widgeted .file-upload-drop-area {
    background-color: #cfcece;
    border-radius: 8px;
    border: 3px dotted #cfcece;
}

.widgeted .file-upload-drop-area:hover,
.widgeted .file-upload-drop-area.dz-drag-hover {
    border-color: white;
}

.file-list {
    margin: 0 !important;
    padding: 10px;
}

.file-list li {
    list-style: none;
    padding: 10px 0 !important;
    border-bottom: thin solid #e0e0e0;
}

.file-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
/* ── Upload library picker (Summernote file-manager plugin) ─────────────────
   Everything below is fm-lib- prefixed. Bootstrap's own names are not usable
   here: the themes restyle .card-body, modules have leaked bare .badge rules,
   and this markup renders inside a dialog on any page of any module — it has
   to be immune to whatever the surrounding app has done to the generic names.
   ------------------------------------------------------------------------- */

.fm-lib-dialog .modal-dialog {
    /* Wide enough for six columns of thumbnails. The picker is a browsing tool
       — at Bootstrap's default 500px it showed two columns and read as a list
       with pictures. 96vw keeps it usable on a laptop screen. */
    max-width: 1180px;
    width: 96vw;
}

/* The dialog is the drop target, so it needs a positioning context for the
   veil that covers it during a drag. */
.fm-lib-dialog .modal-content {
    position: relative;
}

.fm-lib-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.fm-lib-search {
    flex: 1 1 auto;
    min-width: 0;
}

.fm-lib-filter {
    flex: 0 0 140px;
}

/* Fixed height rather than max-height: the dialog must not resize as pages are
   appended, or "load more" walks the button out from under the cursor. */
.fm-lib-results {
    height: 460px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    background: #fff;
}

.fm-lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.fm-lib-item {
    margin: 0;
    padding: 0;
}

.fm-lib-pick {
    display: block;
    width: 100%;
    padding: 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: border-color .12s, box-shadow .12s;
}

.fm-lib-pick:hover,
.fm-lib-pick:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, .25);
    outline: none;
}

.fm-lib-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border-radius: 3px;
    overflow: hidden;
}

.fm-lib-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fm-lib-thumb i {
    font-size: 2.2em;
    color: #6c757d;
}

/* Long upload names are the norm, and a grid cell that grows to fit one of
   them drags the whole row's height with it. */
.fm-lib-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.3;
    color: #212529;
    word-break: break-word;
}

.fm-lib-meta {
    display: block;
    font-size: 10px;
    color: #6c757d;
    margin-top: 2px;
}

.fm-lib-empty {
    color: #6c757d;
    font-style: italic;
    margin: 20px 0;
    text-align: center;
}

.fm-lib-more-wrap {
    text-align: center;
    margin-top: 12px;
}

.fm-lib-more {
    padding: 6px 18px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 13px;
}

.fm-lib-more:hover {
    background: #e9ecef;
}

/* A file whose core_files row outlived the file itself. The <img> removes
   itself on error and tags the thumb, so the cell reads as "missing" rather
   than as a broken picker. */
.fm-lib-thumb.fm-lib-missing::after {
    content: "\f127";                 /* fa-link-slash */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif;
    font-weight: 900;
    font-size: 1.6em;
    color: #adb5bd;
}

.fm-lib-missing + .fm-lib-name {
    color: #adb5bd;
    text-decoration: line-through;
}

/* ── Upload: button, drop veil, progress ─────────────────────────────────── */

.fm-lib-upload-btn {
    flex: 0 0 auto;
    padding: 6px 16px;
    border: 1px solid #0d6efd;
    border-radius: 4px;
    background: #0d6efd;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.fm-lib-upload-btn:hover {
    background: #0b5ed7;
    border-color: #0b5ed7;
}

/* Covers the whole dialog during a drag rather than only the grid: a drop
   aimed at the toolbar or the padding is still a drop somebody meant. */
.fm-lib-dropveil {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, .08);
    border: 3px dashed #0d6efd;
    border-radius: 6px;
    pointer-events: none;          /* or it steals the drop it is advertising */
    font-size: 1.25em;
    font-weight: 600;
    color: #0b5ed7;
}

.fm-lib-dialog.fm-lib-dragging .fm-lib-dropveil {
    display: flex;
}

.fm-lib-progress {
    margin-top: 10px;
    padding: 8px 12px;
    background: #e7f1ff;
    border: 1px solid #b6d4fe;
    border-radius: 4px;
    font-size: 13px;
    color: #084298;
}

.fm-lib-error {
    color: #b02a26;
    font-style: normal;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.fm-lib-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.fm-lib-count {
    font-size: 12px;
    color: #6c757d;
}

.fm-lib-pager {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fm-lib-page {
    min-width: 32px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
}

.fm-lib-page:hover:not(:disabled) {
    background: #e9ecef;
}

.fm-lib-page:disabled {
    opacity: .4;
    cursor: default;
}

.fm-lib-page-on,
.fm-lib-page-on:hover {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    font-weight: 600;
}

.fm-lib-gap {
    padding: 0 2px;
    color: #adb5bd;
}

/* Extension label under the generic file icon, so a PDF is distinguishable
   from a spreadsheet without reading the filename. */
.fm-lib-ext {
    position: absolute;
    bottom: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #6c757d;
}

.fm-lib-thumb {
    position: relative;
}
