/* Fichiers des chantiers : explorateur (documentsChantier) et pièces de la messagerie (documentsMessagerie) de
   list-form-widgets-chantier.js, menu d'actions, photo en grand. Partagé par la liste des chantiers (fenêtre « Documents »)
   et la page /chantiers/documents. */
/* ─ Onglet Documents : pièces jointes de la messagerie chantiers (documentsMessagerie, list-form-widgets-chantier.js) ─ */
.lf-widget .lfw-msgdocs .lfw-msgdoc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    font-weight: 600;
    word-break: break-word;
}

.lf-widget .lfw-msgdocs .lfw-msgdoc i {
    font-size: 20px;
    color: var(--messagerie-color, #26a69a);
}

.lf-widget .lfw-msgdoc-fil {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.lf-widget .lfw-msgdoc-fil[data-canal="equipe"] {
    background: #fff3e0;
    color: #e65100;
}

.lf-widget .lfw-msgdoc-fil[data-canal="responsables"] {
    background: #e0f2f1;
    color: #00796b;
}

.lf-widget .lfw-msgphotos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin: 6px 0 12px;
}

.lf-widget .lfw-msgphoto {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: #eceff1;
}

.lf-widget .lfw-msgphoto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}

.lf-widget .lfw-msgphoto:hover img {
    transform: scale(1.05);
}

/* ─ Photo en grand (openPhotoLightbox, onglet Documents de la fiche chantier) ─ */
.lfw-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000; /* au-dessus de la fiche (modal) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 56px 64px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, .88);
}

.lfw-lightbox.open {
    display: flex;
}

.lfw-lightbox > img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

.lfw-lightbox-caption {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .55);
    color: rgba(255, 255, 255, .85);
    font-size: 13px;
    text-align: center;
}

.lfw-lightbox-count:empty {
    display: none;
}

.lfw-lightbox-count {
    color: rgba(255, 255, 255, .6);
}

.lfw-lightbox-author {
    color: #fff;
    font-weight: 700;
}

.lfw-lightbox-date::first-letter {
    text-transform: uppercase;
}

/* Photos (onglet Documents) : auteur, date et fil sur la miniature */
.lf-widget .lfw-msgphoto {
    position: relative;
}

.lf-widget .lfw-msgphoto-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 6px 5px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    color: #fff;
    font-size: 11px;
    line-height: 1.3;
}

.lf-widget .lfw-msgphoto-info b {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lf-widget .lfw-msgphoto-info span {
    opacity: .85;
}

.lf-widget .lfw-msgphoto-fil {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 0 6px;
    font-size: .65rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.lfw-lightbox-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff !important;
    cursor: pointer;
    transition: background .2s;
}

.lfw-lightbox-btn:hover,
.lfw-lightbox-btn:focus-visible {
    background: rgba(255, 255, 255, .3);
}

.lfw-lightbox-close {
    top: 12px;
    right: 12px;
}

.lfw-lightbox-open {
    top: 12px;
    right: 60px;
}

.lfw-lightbox-prev,
.lfw-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.lfw-lightbox-prev {
    left: 12px;
}

.lfw-lightbox-next {
    right: 12px;
}

.lfw-lightbox-prev i,
.lfw-lightbox-next i {
    font-size: 32px;
}

@media (max-width: 600px) {
    .lfw-lightbox {
        padding: 56px 8px;
    }

    .lfw-lightbox-prev,
    .lfw-lightbox-next {
        top: auto;
        bottom: 44px;
        transform: none;
    }
}

.lfw-lightbox-fil {
    padding: 1px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.lfw-lightbox-fil[data-canal="equipe"] {
    background: #fff3e0;
    color: #e65100 !important;
}

.lfw-lightbox-fil[data-canal="responsables"] {
    background: #e0f2f1;
    color: #00796b !important;
}

/* ─ Documents du chantier (documentsChantier) : avancement de l'envoi ─ */
.lf-widget .lfw-chdoc-progress:not(:empty) {
    margin: 4px 0 8px;
    font-style: italic;
}


/* ── Fichiers du chantier : explorateur (documentsChantier, list-form-widgets-chantier.js) ── */
.lf-widget .lfw-fx {
    position: relative;
}

.lf-widget .lfw-fx-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin: 0 0 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: #f3f6f8;
}

.lf-widget .lfw-fx-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    gap: 2px;
}

.lf-widget .lfw-fx-crumb {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 240px;
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #1565c0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.lf-widget .lfw-fx-crumb span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lf-widget .lfw-fx-crumb i.material-icons {
    font-size: 19px;
}

.lf-widget button.lfw-fx-crumb:hover {
    background: #e3f2fd;
}

.lf-widget .lfw-fx-crumb.current {
    color: #263238;
    cursor: default;
}

.lf-widget .lfw-fx-sep {
    font-size: 18px;
    color: #90a4ae;
}

.lf-widget .lfw-fx-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lf-widget .lfw-fx-views {
    display: inline-flex;
    padding: 2px;
    border-radius: 7px;
    background: #e3e9ed;
}

.lf-widget .lfw-fx-views button,
.lf-widget .lfw-fx-trashbtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #546e7a;
    font: inherit;
    font-size: .85rem;
    cursor: pointer;
}

.lf-widget .lfw-fx-views button i.material-icons,
.lf-widget .lfw-fx-trashbtn i.material-icons {
    font-size: 19px;
}

.lf-widget .lfw-fx-views button.active {
    background: #fff;
    color: #1565c0;
    box-shadow: 0 1px 2px rgba(38, 50, 56, .15);
}

.lf-widget .lfw-fx-trashbtn:hover,
.lf-widget .lfw-fx-trashbtn.active {
    background: #fff;
    color: #263238;
}

.lf-widget .lfw-fx-trashbtn.active {
    box-shadow: 0 1px 2px rgba(38, 50, 56, .15);
}

.lf-widget .lfw-fx-trashbtn b:not(:empty) {
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #78909c;
    color: #fff;
    font-size: .7rem;
    line-height: 18px;
    text-align: center;
}

.lf-widget .lfw-fx-head {
    flex-wrap: wrap;
}

.lf-widget .lfw-fx-head .lfw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.lf-widget .lfw-fx-secondary {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    box-shadow: none !important;
}

.lf-widget .lfw-fx-danger {
    background: #e53935 !important;
}

/* Fichiers glissés depuis l'ordinateur */
.lf-widget .lfw-fx-drop-label {
    display: none;
}

.lf-widget .lfw-fx.lfw-fx-dropping .lfw-fx-drop-label {
    display: block;
    margin: 0 0 6px;
    color: #1565c0;
    font-weight: 600;
    text-align: center;
}

.lf-widget .lfw-fx-body {
    min-height: 120px;
    border: 2px dashed transparent;
    border-radius: 10px;
    transition: border-color .15s, background .15s;
}

.lf-widget .lfw-fx.lfw-fx-dropping .lfw-fx-body {
    border-color: #64b5f6;
    background: #f3f9ff;
}

.lf-widget .lfw-fx-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 12px;
    color: #78909c;
    text-align: center;
}

.lf-widget .lfw-fx-empty i.material-icons {
    font-size: 42px;
    color: #b0bec5;
}

/* Vignettes */
.lf-widget .lfw-fx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
    padding: 4px;
}

.lf-widget .lfw-fx-tile {
    position: relative;
    border: 1px solid #e3e9ed;
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.lf-widget .lfw-fx-tile:hover {
    border-color: #90caf9;
    box-shadow: 0 2px 8px rgba(30, 136, 229, .15);
}

.lf-widget .lfw-fx-tile .lfw-fx-open {
    display: flex;
    flex-direction: column;
    padding: 6px 6px 8px;
    color: #263238;
    text-decoration: none;
}

.lf-widget .lfw-fx-thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 7px;
    background: #f3f6f8;
}

.lf-widget .lfw-fx-thumb i.material-icons {
    font-size: 48px;
}

.lf-widget .lfw-fx-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}

.lf-widget .lfw-fx-tile:hover .lfw-fx-thumb img {
    transform: scale(1.05);
}

.lf-widget .lfw-fx-thumb.folder { background: #fff8e1; }
.lf-widget .lfw-fx-thumb.folder i.material-icons { font-size: 58px; }

.lf-widget .lfw-fx-ext {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 0 5px;
    border-radius: 4px;
    background: var(--fx-kind, #78909c);
    color: #fff;
    font-size: .62rem;
    line-height: 16px;
    text-transform: uppercase;
}

.lf-widget .lfw-fx-name {
    display: -webkit-box;
    margin: 6px 2px 0;
    overflow: hidden;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.lf-widget .lfw-fx-meta {
    margin: 2px 2px 0;
    color: #78909c;
    font-size: .72rem;
}

.lf-widget .lfw-fx-more {
    position: absolute;
    top: 9px;
    right: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .92);
    color: #455a64;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    cursor: pointer;
}

.lf-widget .lfw-fx-more i.material-icons {
    font-size: 19px;
}

.lf-widget .lfw-fx-more:hover {
    background: #fff;
    color: #1565c0;
}

@media (hover: hover) {
    .lf-widget .lfw-fx-tile .lfw-fx-more {
        opacity: 0;
        transition: opacity .15s;
    }

    .lf-widget .lfw-fx-tile:hover .lfw-fx-more,
    .lf-widget .lfw-fx-tile:focus-within .lfw-fx-more {
        opacity: 1;
    }
}

/* Couleurs des icônes par famille de fichier */
.lf-widget .lfw-fx-thumb.folder, .lf-widget .lfw-fx-ico.folder { color: #f9a825; }
.lf-widget .lfw-fx-thumb.doc, .lf-widget .lfw-fx-ico.doc { color: var(--fx-kind); }
.lf-widget .pdf { --fx-kind: #e53935; }
.lf-widget .sheet { --fx-kind: #2e7d32; }
.lf-widget .slides { --fx-kind: #ef6c00; }
.lf-widget .plan { --fx-kind: #3949ab; }
.lf-widget .text { --fx-kind: #1e88e5; }

/* Liste */
.lf-widget .lfw-fx-table .lfw-fx-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.lf-widget .lfw-fx-table .lfw-fx-sort:hover,
.lf-widget .lfw-fx-table .lfw-fx-sort.active {
    color: #1565c0;
}

.lf-widget .lfw-fx-table .lfw-fx-sort i.material-icons {
    margin-left: 2px;
    font-size: 15px;
    vertical-align: -3px;
}

.lf-widget .lfw-fx-table tbody tr:hover {
    background: #f5f9fd;
}

.lf-widget .lfw-fx-rowname {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #263238;
    font-weight: 600;
    word-break: break-word;
}

.lf-widget .lfw-fx-rowname:hover span:last-child {
    color: #1565c0;
    text-decoration: underline;
}

.lf-widget .lfw-fx-ico {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 6px;
    background: #f3f6f8;
}

.lf-widget .lfw-fx-ico.folder { background: #fff8e1; }

.lf-widget .lfw-fx-ico i.material-icons {
    font-size: 21px;
}

.lf-widget .lfw-fx-ico img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lf-widget .lfw-fx-table .lfw-fx-more {
    position: static;
    background: none;
    box-shadow: none;
}

.lf-widget .lfw-fx-table .lfw-fx-more:hover {
    background: #eceff1;
}

/* Glisser-déposer */
.lf-widget .lfw-fx-dragging {
    opacity: .4;
}

.lf-widget .lfw-fx-over {
    outline: 2px solid #1e88e5 !important;
    outline-offset: -2px;
    background: #e3f2fd !important;
}

.lf-widget [draggable="true"] {
    cursor: grab;
}

/* Menu d'actions (au-dessus des fenêtres) */
.lfw-fx-menu {
    position: fixed;
    z-index: 1500;
    min-width: 200px;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(38, 50, 56, .25);
}

.lfw-fx-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #263238;
    font: inherit;
    font-size: .9rem;
    text-align: left;
    cursor: pointer;
}

.lfw-fx-menu button i.material-icons {
    font-size: 19px;
    color: #607d8b;
}

.lfw-fx-menu button:hover,
.lfw-fx-menu button:focus-visible,
.lfw-fx-menu button.kbd {
    background: #eef4fa;
    outline: none;
}

.lfw-fx-menu button.danger,
.lfw-fx-menu button.danger i.material-icons {
    color: #c62828;
}

@media (max-width: 600px) {
    .lf-widget .lfw-fx-grid {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 8px;
    }

    .lf-widget .lfw-fx-views button,
    .lf-widget .lfw-fx-trashbtn span {
        font-size: .8rem;
    }
}

/* ── Pièces de la messagerie (documentsMessagerie) : même explorateur que les fichiers du chantier, filtres par type et par fil ── */
.lf-widget .lfw-fx-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    min-width: 0;
}

.lf-widget .lfw-fx-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
    border-radius: 7px;
    background: #e3e9ed;
}

.lf-widget .lfw-fx-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: #546e7a;
    font: inherit;
    font-size: .85rem;
    cursor: pointer;
}

.lf-widget .lfw-fx-chip i.material-icons {
    font-size: 17px;
}

.lf-widget .lfw-fx-chip b {
    color: #90a4ae;
    font-weight: 600;
}

.lf-widget .lfw-fx-chip.active {
    background: #fff;
    color: #1565c0;
    box-shadow: 0 1px 2px rgba(38, 50, 56, .15);
}

.lf-widget .lfw-fx-chip.active b {
    color: #1565c0;
}

.lf-widget .lfw-fx-chip .lfw-msgdoc-fil {
    font-size: .72rem;
}

/* Interrupteur « Afficher les pièces rangées » */
.lf-widget .lfw-fx-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #455a64;
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
}

.lf-widget .lfw-fx-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lf-widget .lfw-fx-switch-track {
    position: relative;
    flex: none;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: #b0bec5;
    transition: background .15s;
}

.lf-widget .lfw-fx-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    transition: transform .15s;
}

.lf-widget .lfw-fx-switch input:checked + .lfw-fx-switch-track {
    background: #1e88e5;
}

.lf-widget .lfw-fx-switch input:checked + .lfw-fx-switch-track::after {
    transform: translateX(14px);
}

.lf-widget .lfw-fx-switch input:focus-visible + .lfw-fx-switch-track {
    outline: 2px solid #90caf9;
    outline-offset: 2px;
}

.lf-widget .lfw-fx-switch b {
    color: #90a4ae;
    font-weight: 600;
}

.lf-widget .lfw-fx-trashbtn.lfw-spin i.material-icons {
    animation: lfw-spin 1s linear infinite;
}

@keyframes lfw-spin {
    to { transform: rotate(360deg); }
}

.lf-widget .lfw-fx-thumb .lfw-fx-fil {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 0 6px;
    font-size: .62rem;
    line-height: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.lf-widget .lfw-fx-name.unnamed {
    color: #78909c;
    font-weight: 500;
}

.lf-widget .lfw-fx-tile-foot {
    padding: 0 6px 8px;
    margin-top: -2px;
}

.lf-widget .lfw-fx-tile-foot .lfw-msg-range {
    margin-left: 0;
}

.lf-widget .lfw-msg-range {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 3px;
    max-width: 100%;
    margin-left: 6px;
    padding: 0 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #fff8e1;
    color: #8d6e00;
    font-size: .72rem;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lf-widget .lfw-msgphotos .lfw-msg-range {
    margin-left: 0;
}

.lf-widget .lfw-msg-range i.material-icons {
    font-size: 14px;
    color: #f9a825;
}

.lf-widget .lfw-msg-range.trash {
    background: #eceff1;
    color: #78909c;
}

/* Explorateur : pièce venue de la messagerie */
.lf-widget .lfw-fx-src {
    position: absolute;
    top: 6px;
    left: 6px;
    display: inline-flex;
    padding: 3px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .92);
    color: #00897b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.lf-widget .lfw-fx-thumb .lfw-fx-src i.material-icons {
    font-size: 15px;
}

.lf-widget .lfw-fx-src-ico {
    font-size: 16px;
    color: #00897b;
}

/* Vignettes rangées par type (chGroupedGrid) : une ligne par type, avec son titre */
.lf-widget .lfw-fx-group + .lfw-fx-group {
    margin-top: 10px;
}

.lf-widget .lfw-fx-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 4px 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eceff1;
    color: #546e7a;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.lf-widget .lfw-fx-group-head i.material-icons {
    font-size: 16px;
    color: #90a4ae;
}

.lf-widget .lfw-fx-group-head b {
    color: #90a4ae;
    font-weight: 600;
}

.lf-widget .lfw-fx-group[data-type-group="folder"] .lfw-fx-group-head i.material-icons { color: #f9a825; }
.lf-widget .lfw-fx-group[data-type-group="pdf"] .lfw-fx-group-head i.material-icons { color: #e53935; }
.lf-widget .lfw-fx-group[data-type-group="sheet"] .lfw-fx-group-head i.material-icons { color: #2e7d32; }
.lf-widget .lfw-fx-group[data-type-group="slides"] .lfw-fx-group-head i.material-icons { color: #ef6c00; }
.lf-widget .lfw-fx-group[data-type-group="plan"] .lfw-fx-group-head i.material-icons { color: #3949ab; }
.lf-widget .lfw-fx-group[data-type-group="text"] .lfw-fx-group-head i.material-icons { color: #1e88e5; }

/* Étiquette « dossier » d'une pièce de la messagerie : bouton qui ouvre le dossier dans les fichiers du chantier */
.lf-widget button.lfw-msg-range {
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.lf-widget button.lfw-msg-range:hover {
    background: #ffecb3;
    text-decoration: underline;
}

/* Fichier montré depuis la messagerie (étiquette « dossier ») */
.lf-widget .lfw-fx-flash {
    animation: lfw-fx-flash 2s ease-out;
}

@keyframes lfw-fx-flash {
    0%, 30% { box-shadow: 0 0 0 3px #ffb300; background: #fff8e1; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Boutons « Nouveau dossier » / « Ajouter des documents » (ou « Vider la corbeille ») dans la barre de l'explorateur */
.lf-widget .lfw-fx-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.lf-widget .lfw-fx-bar-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lf-widget .lfw-fx-bar-actions .btn {
    display: inline-flex;
    align-items: center;
    height: 34px;
    line-height: 34px;
    padding: 0 14px;
    font-size: .8rem;
}

.lf-widget .lfw-fx-bar-actions .btn i.material-icons {
    margin-right: 6px;
    font-size: 18px;
}

.lf-widget .lfw-fx-hint {
    margin: 0 2px 8px;
    font-size: .8rem;
}

@media (max-width: 600px) {
    .lf-widget .lfw-fx-tools {
        width: 100%;
    }

}

/* Partie gauche de la barre de l'explorateur : chemin et filtre Tout / Photos / Documents */
.lf-widget .lfw-fx-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    min-width: 0;
}

.lf-widget .lfw-fx-chips[hidden] {
    display: none;
}

/* Bouton « Fichiers affichés » (tous, fichiers du chantier, messagerie) : ouvre un menu de choix */
.lf-widget button.lfw-fx-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 6px 0 10px;
    border: 1px solid #d5dde2;
    border-radius: 7px;
    background: #fff;
    color: #37474f;
    font: inherit;
    font-size: .85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.lf-widget button.lfw-fx-source[hidden] {
    display: none;
}

.lf-widget button.lfw-fx-source:hover,
.lf-widget button.lfw-fx-source[aria-expanded="true"] {
    border-color: #90caf9;
    box-shadow: 0 1px 4px rgba(30, 136, 229, .15);
}

.lf-widget button.lfw-fx-source:focus-visible {
    outline: 2px solid #90caf9;
    outline-offset: 1px;
}

.lf-widget button.lfw-fx-source i.material-icons {
    font-size: 18px;
    color: #607d8b;
}

.lf-widget button.lfw-fx-source b {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background: #eceff1;
    color: #546e7a;
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
}

.lf-widget button.lfw-fx-source .lfw-fx-source-caret {
    transition: transform .15s;
}

.lf-widget button.lfw-fx-source[aria-expanded="true"] .lfw-fx-source-caret {
    transform: rotate(180deg);
}

/* Filtre actif (pas « Tous les fichiers ») : bouton en bleu */
.lf-widget button.lfw-fx-source.filtered {
    border-color: #90caf9;
    background: #e3f2fd;
    color: #1565c0;
}

.lf-widget button.lfw-fx-source.filtered i.material-icons {
    color: #1e88e5;
}

.lf-widget button.lfw-fx-source.filtered b {
    background: #1e88e5;
    color: #fff;
}

/* Menu de choix : libellé et explication, pastille du nombre, coche du choix en cours */
.lfw-fx-menu .lfw-fx-menu-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.lfw-fx-menu .lfw-fx-menu-text small {
    color: #78909c;
    font-size: .75rem;
}

.lfw-fx-menu .lfw-fx-menu-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #eceff1;
    color: #546e7a;
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
}

.lfw-fx-menu button i.material-icons.lfw-fx-menu-check {
    width: 18px;
    font-size: 18px;
    color: #1e88e5;
}

.lfw-fx-menu button.active {
    background: #e3f2fd;
}

.lfw-fx-menu button.active:hover,
.lfw-fx-menu button.active.kbd {
    background: #d4e9fb;
}

.lfw-fx-menu button.active > i.material-icons:first-child,
.lfw-fx-menu button.active .lfw-fx-menu-text > span {
    color: #1565c0;
}

.lfw-fx-menu button.active .lfw-fx-menu-text > span {
    font-weight: 600;
}

.lfw-fx-menu button.active .lfw-fx-menu-count {
    background: #1e88e5;
    color: #fff;
}

/* Aide derrière le bouton « i » de la barre (explorateur et messagerie) */
.lf-widget .lfw-fx-info {
    padding: 0 6px;
}

.lf-widget .lfw-fx-info.active {
    background: #e3f2fd;
    color: #1565c0;
}

.lf-widget .lfw-fx-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #e3f2fd;
    color: #0d47a1;
    font-size: .82rem;
    line-height: 1.4;
}

.lf-widget .lfw-fx-hint[hidden] {
    display: none;
}

.lf-widget .lfw-fx-hint i.material-icons {
    flex: none;
    font-size: 18px;
    color: #1e88e5;
}

.lf-widget a.lfw-fx-trashbtn {
    text-decoration: none;
}

.lf-widget .lfw-fx-trashbtn .lfw-fx-ext-link {
    font-size: 14px !important;
    color: #90a4ae;
}

/* Boutons de la barre sans texte (nom dans la bulle d'aide), sauf « Vider la corbeille » */
.lf-widget .lfw-fx-tools .lfw-fx-trashbtn > span {
    display: none;
}

.lf-widget .lfw-fx-tools .lfw-fx-trashbtn {
    min-width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0 6px;
}

.lf-widget .lfw-fx-tools .lfw-fx-trashbtn .lfw-fx-ext-link {
    display: none;
}

/* Sous la barre d'outils : chemin (Documents › Plans › …, dans un dossier ou la corbeille) à gauche, boutons « Nouveau
   dossier » / « Ajouter des fichiers » (ou « Vider la corbeille ») à droite */
.lf-widget .lfw-fx-subbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    min-height: 40px;
    margin: -2px 0 6px;
    padding: 0 0 0 4px;
}

.lf-widget .lfw-fx-subbar[hidden] {
    display: none;
}

.lf-widget .lfw-fx-pathbar {
    display: flex;
    flex: 1 1 220px; /*(trop étroit, sur téléphone : les boutons passent à la ligne)*/
    align-items: center;
    min-width: 0;
}

.lf-widget .lfw-fx-subbar .lfw-fx-bar-actions {
    margin-left: auto;
}

.lf-widget .lfw-fx-pathbar[hidden] {
    display: none;
}

/* Vignettes plus petites (explorateur et messagerie) */
.lf-widget .lfw-fx-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 8px;
}

.lf-widget .lfw-fx-tile .lfw-fx-open {
    padding: 5px 5px 6px;
}

.lf-widget .lfw-fx-thumb {
    aspect-ratio: 3 / 2;
}

.lf-widget .lfw-fx-thumb i.material-icons {
    font-size: 32px;
}

.lf-widget .lfw-fx-thumb.folder i.material-icons {
    font-size: 40px;
}

.lf-widget .lfw-fx-name {
    margin-top: 5px;
    font-size: .78rem;
}

.lf-widget .lfw-fx-meta {
    font-size: .68rem;
}

.lf-widget .lfw-fx-ext {
    bottom: 4px;
    right: 4px;
    font-size: .56rem;
    line-height: 14px;
}

.lf-widget .lfw-fx-more {
    top: 7px;
    right: 7px;
    width: 24px;
    height: 24px;
}

.lf-widget .lfw-fx-more i.material-icons {
    font-size: 17px;
}

.lf-widget .lfw-fx-ico {
    width: 26px;
    height: 26px;
}

.lf-widget .lfw-fx-ico i.material-icons {
    font-size: 18px;
}

@media (max-width: 600px) {
    .lf-widget .lfw-fx-grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    }
}

/* « Nouveau dossier » : vignette en pointillés en tête des dossiers, ligne en tête de la liste */
.lf-widget button.lfw-fx-newfolder.lfw-fx-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px 5px 8px;
    border: 1.5px dashed #c5d0d6;
    background: none;
    color: #78909c;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile .lfw-fx-thumb {
    width: 100%;
    background: #f7f9fa;
    color: #b0bec5;
    transition: background .15s, color .15s;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile .lfw-fx-thumb i.material-icons {
    font-size: 46px;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile .lfw-fx-name {
    padding: 0 3px;
    font-weight: 500;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile:hover,
.lf-widget button.lfw-fx-newfolder.lfw-fx-tile:focus-visible {
    border-color: #f9a825;
    background: #fffdf5;
    color: #e08e00;
    outline: none;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile:hover .lfw-fx-thumb,
.lf-widget button.lfw-fx-newfolder.lfw-fx-tile:focus-visible .lfw-fx-thumb {
    background: #fff8e1;
    color: #f9a825;
}

.lf-widget .lfw-fx-group + .lfw-fx-empty {
    margin-top: 10px;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-rowname {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: #78909c;
    font: inherit;
    cursor: pointer;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-rowname .lfw-fx-ico {
    border: 1.5px dashed #c5d0d6;
    background: none;
    color: #b0bec5;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-rowname:hover,
.lf-widget button.lfw-fx-newfolder.lfw-fx-rowname:hover .lfw-fx-ico {
    border-color: #f9a825;
    color: #e08e00;
}

/* « Nouveau dossier » au dernier niveau permis : grisé */
.lf-widget button.lfw-fx-newfolder:disabled,
.lf-widget button.lfw-fx-newfolder:disabled:hover {
    border-color: #dfe5e8;
    background: none;
    color: #b0bec5;
    cursor: not-allowed;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-tile:disabled .lfw-fx-thumb {
    background: #f7f9fa;
    color: #cfd8dc;
}

.lf-widget button.lfw-fx-newfolder.lfw-fx-rowname:disabled .lfw-fx-ico {
    border-color: #dfe5e8;
    color: #cfd8dc;
}

/* « Nouveau dossier » en petit (aucun dossier ici, racine comprise) : icône seule en pointillés, dans la section Dossiers */
.lf-widget button.lfw-fx-newfolder-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 34px;
    padding: 0;
    border: 1.5px dashed #c5d0d6;
    border-radius: 8px;
    background: none;
    color: #b0bec5;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}

.lf-widget button.lfw-fx-newfolder-mini i.material-icons {
    font-size: 20px;
}

.lf-widget button.lfw-fx-newfolder-mini:hover,
.lf-widget button.lfw-fx-newfolder-mini:focus-visible {
    border-color: #f9a825;
    background: #fff8e1;
    color: #f9a825;
    outline: none;
}
