/* CSS custom du dashboard (complète Bulma). */

main { padding-bottom: 4rem; }

/* ===== Layout dashboard : menu latéral + contenu ===== */
:root { --dash-sidebar-w: 240px; }

.dash { min-height: 100vh; }

.dash-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--dash-sidebar-w);
    background: #1f2229;
    color: #cfd3da;
    display: flex;
    flex-direction: column;
    z-index: 30;
}
.dash-brand {
    padding: 1rem 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.dash-brand a { color: #fff; display: block; }
.dash-brand-logo { height: 26px; width: auto; display: block; }
.dash-menu { flex: 1; min-height: 0; padding: .5rem 0; overflow-y: auto; }
.dash-group { padding: .35rem 0; }
.dash-group + .dash-group { border-top: 1px solid rgba(255, 255, 255, .06); }
.dash-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem 1.25rem .25rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0;
    cursor: pointer;
    user-select: none;
}
.dash-group-title:hover { color: #9aa0ab; }
/* Chevron de pliage : pointe vers le bas (déplié), vers la droite (replié). */
.dash-group-title::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: .55rem;
    color: #555b66;
    transition: transform .15s ease;
}
.dash-group.is-collapsed .dash-group-title::after { transform: rotate(-90deg); }
/* Groupe replié : seuls les titres (grandes catégories) restent visibles. */
.dash-group.is-collapsed .dash-link { display: none; }
.dash-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .42rem 1.25rem;
    font-size: .82rem;
    color: #cfd3da;
    border-left: 3px solid transparent;
}
.dash-link .icon { font-size: .8rem; }

/* Pastille rouge (compteur) : commandes du jour sur le lien et son groupe parent. */
.dash-badge {
    min-width: 1.05rem;
    padding: 0 .35rem;
    height: 1.05rem;
    line-height: 1.05rem;
    border-radius: .6rem;
    background: #e0245e;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    text-align: center;
}
.dash-link .dash-badge { margin-left: auto; }
.dash-group-title .dash-badge-groupe { margin-left: auto; margin-right: .45rem; }
/* Le badge du groupe ne sert qu'à résumer quand le groupe est replié : déplié, le
   badge du lien (Commandes) est déjà visible → on masque celui du titre. */
.dash-group:not(.is-collapsed) .dash-group-title .dash-badge-groupe { display: none; }

/* Recherche d'items dans le menu (discrète, en haut de la colonne). */
.dash-search {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .5rem .9rem .25rem;
    padding: .3rem .6rem;
    background: rgba(255, 255, 255, .06);
    border-radius: 6px;
}
.dash-search .icon { color: #6b7280; font-size: .8rem; }
.dash-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: #e6e8ec;
    font-size: .8rem;
}
.dash-search input::placeholder { color: #6b7280; }
/* Badge clavier (Ctrl K) dans le champ de recherche + indices discrets. */
.dash-search-kbd {
    flex-shrink: 0;
    font-size: .6rem;
    color: #8b919c;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 4px;
    padding: .05rem .3rem;
    letter-spacing: .03em;
}
.dash-search-hint {
    margin: 0 .9rem .4rem;
    color: #6b7280;
    font-size: .68rem;
}
.dash-search-hint kbd {
    font-size: .62rem;
    color: #cfd3da;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 3px;
    padding: 0 .25rem;
}
.dash-search-vide { padding: .6rem 1.25rem; color: #6b7280; font-size: .8rem; }
.dash-link .icon { color: #8b919c; }
.dash-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.dash-link:hover .icon, .dash-link.is-active .icon { color: #fff; }
.dash-link.is-active {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-left-color: #3273dc;
    font-weight: 600;
}
/* Actions d'une ligne de liste : les boutons ne doivent jamais passer à la ligne. */
td .buttons { flex-wrap: nowrap; }

/* Sous-entrées (ex. Codes tarifs → Formules / Tarifs simples). */
.dash-sublink {
    padding: .4rem 1.25rem .4rem 3rem;
    font-size: .85rem;
    color: #aeb3bd;
}
.dash-sublink .icon { font-size: .7rem; }
.dash-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.dash-user-email {
    display: block;
    font-size: .8rem;
    color: #9aa1ad;
    margin-bottom: .5rem;
    word-break: break-word;
}

.dash-content { margin-left: var(--dash-sidebar-w); }

/* Topbar : visible surtout en mobile, reste sur UNE ligne. */
.dash-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: 56px;
    padding: 0 1.25rem;
    background: #1f2229;
    color: #f4f5f7;
    border-bottom: 1px solid #2c2f37;
}
.dash-topbar-title { font-weight: 800; letter-spacing: 3px; white-space: nowrap; color: #f4f5f7; }
.dash-topbar-title:hover { color: #fff; }
.dash-topbar-logo { height: 26px; width: auto; display: block; }
.dash-topbar-user { margin-left: auto; display: flex; align-items: center; gap: .65rem; }
.dash-topbar-email { font-size: .82rem; color: #b9bdc6; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.dash-topbar-logout { display: inline-flex; color: #cfd2d9; padding: .35rem; border-radius: 6px; }
.dash-topbar-logout:hover { background: #2c2f37; color: #fff; }

/* Burger (caché sur desktop). */
.dash-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px; height: 40px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px;
}
.dash-burger span {
    display: block;
    height: 2px;
    background: #f4f5f7;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

/* Pied de sidebar (email + déconnexion) : visible en mobile uniquement. */
.dash-foot { display: none; }

.dash-overlay { display: none; }

/* ===== Mobile : sidebar off-canvas ===== */
@media (max-width: 1023px) {
    .dash-content { margin-left: 0; }
    .dash-burger { display: flex; }

    .dash-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, .3);
    }
    .dash-sidebar.is-open { transform: translateX(0); }

    .dash-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 20;
    }
    .dash-overlay.is-active { display: block; }

    /* L'utilisateur passe de la topbar au pied de la sidebar slide-in. */
    .dash-topbar-user { display: none; }
    .dash-foot {
        display: flex;
        align-items: center;
        gap: .65rem;
        flex-shrink: 0;
        padding: .85rem 1.25rem;
        background: #1f2229;
        border-top: 1px solid rgba(255, 255, 255, .08);
    }
    .dash-foot-email { font-size: .82rem; color: #b9bdc6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dash-foot-logout { margin-left: auto; display: inline-flex; color: #cfd2d9; padding: .35rem; border-radius: 6px; }
    .dash-foot-logout:hover { background: #2c2f37; color: #fff; }
}

/* Desktop : pas de topbar nécessaire (sidebar toujours visible). */
/* La navbar (topbar) reste visible sur desktop : logo SO PRESS + utilisateur. */

/* ===== Tables de listing en cartes empilées (mobile) =====
   Sur petit écran, une table .table-cards devient une pile de cartes : l'en-tête
   est masqué et chaque cellule affiche son intitulé via data-label sur le <td>.
   Mettre data-label="" (ou l'omettre) sur une cellule d'actions pour ne pas
   afficher d'intitulé. Évite tout débordement horizontal du viewport. */
@media (max-width: 768px) {
    .table-cards,
    .table-cards tbody,
    .table-cards tr,
    .table-cards td { display: block; width: 100%; }

    .table-cards thead { display: none; }

    .table-cards tr {
        margin-bottom: .75rem;
        padding: .35rem .85rem;
        border: 1px solid #e7e9ee;
        border-radius: 8px;
        background: #fff;
    }

    /* Intitulé à gauche, valeur à droite. La valeur est enveloppée dans
       .td-val (colonne) pour que ses sous-éléments s'empilent et que la cellule
       puisse rétrécir — aucun débordement horizontal. */
    .table-cards td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        min-width: 0;
        text-align: right;
        border: 0 !important;
        padding: .4rem 0 !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .table-cards tr td + td { border-top: 1px solid #f0f1f4 !important; }

    .table-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        white-space: nowrap;
    }
    /* La valeur : empile ses éléments à droite et peut rétrécir. */
    .table-cards td .td-val {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: .25rem;
        min-width: 0;
    }
    /* Cellule sans intitulé (actions, vignette) : pas de label, alignée à droite. */
    .table-cards td:not([data-label])::before,
    .table-cards td[data-label=""]::before { content: none; }
    .table-cards td:not([data-label]),
    .table-cards td[data-label=""] { justify-content: flex-end; }

    /* Boutons d'action en bout de ligne : on affiche leur intitulé (title) à côté
       de l'icône, et on autorise le retour à la ligne pour éviter tout débordement. */
    .table-cards td .buttons {
        margin-bottom: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .table-cards td:not([data-label]) .button[title]::after,
    .table-cards td[data-label=""] .button[title]::after {
        content: attr(title);
        margin-left: .5rem;
    }

    /* Barres de filtre/recherche (form.field.is-grouped) : au lieu de tout
       compresser sur une ligne, on empile chaque contrôle sur toute la largeur. */
    form.field.is-grouped { flex-wrap: wrap; }
    form.field.is-grouped > .control {
        flex: 1 1 100%;
        min-width: 0 !important;
        margin-right: 0;
    }
    form.field.is-grouped .input,
    form.field.is-grouped .select,
    form.field.is-grouped .select select,
    form.field.is-grouped .button { width: 100%; }
    form.field.is-grouped .button { justify-content: center; }
}

/* Split-screen éditeur : config à gauche, aperçu à droite. */
.editeur {
    display: grid;
    grid-template-columns: 1fr minmax(600px, 900px);
    gap: 1.5rem;
    align-items: start;
}
.editeur .panneau-config { min-width: 0; }
.editeur .panneau-apercu {
    --apercu-scale: 1;              /* facteur d'échelle de l'iframe (1 = taille réelle) */
    position: sticky;
    top: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.editeur .panneau-apercu iframe {
    /* La hauteur est calée par JS sur la hauteur réelle du contenu (cf apercu-live.js
       + le posteur de hauteur d'index.php) ; 80vh n'est qu'un repli initial. */
    width: calc(100% / var(--apercu-scale));
    height: 80vh;
    border: 0;
    display: block;
    transform: scale(var(--apercu-scale));
    transform-origin: top left;
}

/* Petit écran de bureau : le split-screen écrase le panneau de config. On donne
   la majorité de la largeur à la config et on met l'iframe à l'échelle 0.75 — elle
   rend une largeur virtuelle plus grande (≈ 1.33×) pour garder un aperçu « desktop »
   dans une colonne plus étroite. */
@media (min-width: 1024px) and (max-width: 1600px) {
    .editeur { grid-template-columns: minmax(0, 1fr) 44%; }
    .editeur .panneau-apercu { --apercu-scale: .50; }
}

@media (max-width: 1023px) {
    .editeur { grid-template-columns: 1fr; }
    .editeur .panneau-apercu { position: static; }
}

/* Aperçu d'OFFRE : une seule card. Inutile de réduire toute une page de vente —
   on rend à l'échelle réelle pour que la card occupe toute la largeur du panneau
   (bien plus lisible), et on élargit un peu le panneau d'aperçu. */
#form-offre .editeur { grid-template-columns: minmax(0, 1fr) minmax(440px, 620px); }
#form-offre .editeur .panneau-apercu { --apercu-scale: 1; }
@media (min-width: 1024px) and (max-width: 1600px) {
    #form-offre .editeur { grid-template-columns: minmax(0, 1fr) 46%; }
}

/* Filtres des codes tarifs : sur desktop plus étroit que 1600px, la barre unique
   (recherche + 3 selects + boutons) devient trop serrée → on passe la recherche
   sur sa propre ligne (pleine largeur) et le reste des filtres dessous. */
@media (min-width: 1024px) and (max-width: 1600px) {
    .filtres-tarifs { flex-wrap: wrap; }
    .filtres-tarifs > .control.is-expanded { flex-basis: 100%; }
}

/* Dossiers de la librairie de médias. */
.dossiers-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}
.dossier-carte {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: .5rem .75rem;
    background: #fafafa;
}
.dossier-lien { display: flex; align-items: flex-start; gap: .5rem; color: inherit; min-width: 0; }
.dossier-lien .icon { color: #f5c451; flex: 0 0 auto; margin-top: .1rem; }
/* Nom affiché en entier ; tronqué seulement s'il est vraiment très long (2 lignes). */
.dossier-nom {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
/* Aperçus : jusqu'à 3 vignettes carrées des médias les plus récents du dossier
   (et de ses sous-dossiers), entre le nom et la rangée du bas. */
.dossier-apercus { display: flex; gap: .3rem; }
.dossier-apercu {
    flex: 0 0 calc((100% - .6rem) / 6);
    aspect-ratio: 1 / 1;
    min-width: 0;
    object-fit: contain;
    border-radius: 5px;
    background: #eee;
    border: 1px solid rgba(0, 0, 0, .06);
    display: block;
}
/* Rangée du bas : compteur à gauche, actions à droite. */
.dossier-bas { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.dossier-actions { display: flex; gap: .15rem; }
/* Compteur du dossier : icônes + nombres espacés proprement (pas de chevauchement). */
.dossier-compteur { gap: .25rem; }
.dossier-compteur .icon { margin: 0 !important; }
/* La carte « nouveau dossier » garde une disposition en ligne. */
.dossier-nouveau { flex-direction: row; align-items: center; gap: .35rem; }
.dossier-nouveau .input { flex: 1; min-width: 0; }
/* Cible de dépôt mise en avant pendant un glisser/déposer de média. */
.dossier-carte.glisser-survol,
.breadcrumb a.glisser-survol {
    border-color: #3273dc;
    background: #eef3fd;
    outline: 2px dashed #3273dc;
    outline-offset: -2px;
}

/* Actions sous une vignette média (renommer / déplacer / supprimer). */
.media-actions { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.media-actions .select,
.media-actions .select select { max-width: 100%; }

/* Vignette média dans la librairie / le sélecteur. */
.media-grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}
.media-vignette {
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #fafafa;
    transition: border-color .15s;
}
.media-vignette.is-selected { border-color: #3273dc; }
.media-vignette[draggable="true"] { cursor: grab; }
.media-vignette[draggable="true"]:active { cursor: grabbing; }
.media-vignette img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    background: #fff;
}
.media-vignette .nom {
    font-size: .75rem;
    padding: .25rem .4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Champ de sélection d'image dans les forms. */
/* « Retirer » : caché tant qu'aucune image n'est présente (rien à retirer). */
.champ-media:not(.a-image) [data-media-clear] { display: none; }
.champ-media-apercu img {
    max-width: 160px;
    max-height: 120px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: block;
}

/* Liste ordonnée des offres dans l'éditeur. */
.liste-offres { list-style: none; margin: 0; }
.offre-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .25rem;
    border-bottom: 1px solid #f0f0f0;
}
.offre-item:last-child { border-bottom: 0; }
.offre-item .offre-ordre { white-space: nowrap; display: flex; gap: .25rem; align-items: center; }
.offre-item .offre-ordre .button { padding: 0 .5rem; }
/* Flèches monter/descendre d'une offre : utiles seulement au tactile (sur desktop,
   le réordonnancement se fait au glisser-déposer). Masquées par défaut, affichées
   uniquement sur appareils tactiles (mobile/tablette). */
.touch-only { display: none !important; }
@media (hover: none) and (pointer: coarse) {
    .touch-only { display: inline-flex !important; }
}
/* Case « Visible » d'une offre. */
.offre-visible {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    color: #555;
    cursor: pointer;
    user-select: none;
    margin-right: .35rem;
}
.offre-visible input { cursor: pointer; }
/* Offre masquée : grisée + nom barré, mais toujours listée. */
.offre-item.offre-masquee { opacity: .55; }
.offre-item.offre-masquee .offre-lib { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); }

/* Éditeur de groupes. */
.groupe-bloc {
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: .75rem;
    margin-bottom: 1rem;
    background: #fafafa;
}
.groupe-head { display: flex; gap: .35rem; align-items: center; margin-bottom: .5rem; }
.groupe-head .input { flex: 1; }
.groupe-head .groupe-visible { flex: 0 0 auto; }
/* Groupe masqué : bloc grisé (mais toujours éditable). Le titre et les offres
   gardent leur opacité propre ; on atténue surtout l'en-tête et le fond. */
.groupe-bloc.groupe-masque { opacity: .6; background: #f3f3f3; border-style: dashed; }
.groupe-bloc.groupe-masque .groupe-visible { opacity: 1; } /* la case reste lisible */
.groupe-offres { list-style: none; margin: 0 0 .5rem; }
.groupe-offres .offre-item { background: #fff; border: 1px solid #eee; border-radius: 6px; margin-bottom: .35rem; padding: .4rem .5rem; }
.groupe-vide { color: #999; font-size: .8rem; padding: .35rem .25rem; }
.groupe-ajout { width: 100%; }
.groupe-ajout select { width: 100%; }

/* Overlay de synchronisation (tarifs). */
.sync-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .88);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sync-overlay[hidden] { display: none; }
.sync-box { text-align: center; max-width: 420px; padding: 1.5rem; }
.sync-titre { font-weight: 700; margin-top: 1rem; }
.sync-progress { color: #3273dc; font-weight: 700; margin-top: .5rem; }
.sync-sous { color: #555; font-size: .9rem; margin-top: .35rem; }
.sync-spinner {
    display: inline-block;
    width: 48px; height: 48px;
    border: 4px solid #dbe3f4;
    border-top-color: #3273dc;
    border-radius: 50%;
    animation: sync-spin .8s linear infinite;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }

/* Selectpicker async des supports : fermé, il ressemble à un <select>. */
.support-picker { position: relative; }
.support-picker .sp-search { padding-right: 2.5em; cursor: pointer; }
/* Chevron façon Bulma select. */
.support-picker::after {
    content: "";
    position: absolute;
    right: 1.05em;
    top: 50%;
    width: .55em;
    height: .55em;
    border: 2px solid #3273dc;
    border-top: 0;
    border-right: 0;
    transform: translateY(-65%) rotate(-45deg);
    pointer-events: none;
}
.support-picker .sp-results {
    display: none;
    position: absolute;
    z-index: 40;
    left: 0; right: 0;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
    max-height: 260px;
    overflow-y: auto;
}
.support-picker .sp-results.is-ouvert { display: block; }
.support-picker .sp-item {
    padding: .45rem .75rem;
    cursor: pointer;
    font-size: .9rem;
}
.support-picker .sp-item:hover { background: #f0f4ff; }
.support-picker .sp-item.sp-vide { color: #999; font-style: italic; }
/* Indice persistant en tête : rappelle qu'on peut taper pour filtrer. */
.support-picker .sp-hint {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    color: #7a7a7a;
    font-size: .72rem;
    line-height: 1.3;
    padding: .4rem .75rem;
    border-bottom: 1px solid #eee;
    cursor: default;
}
/* Pied cliquable « charger la suite » (chargement async au scroll). */
.support-picker .sp-load {
    padding: .45rem .75rem;
    font-size: .82rem;
    color: #3273dc;
    text-align: center;
    cursor: pointer;
}
.support-picker .sp-load:hover { background: #f0f4ff; }

/* Onglets de l'éditeur : panneaux masqués via .is-hidden (fourni par Bulma). */
.onglet-pane { padding-top: .25rem; }

/* Édition verrouillée (issue #14) : panneau de config en lecture seule. La barre
   d'onglets et l'aperçu restent navigables ; seuls les champs sont neutralisés. */
.est-verrouille .panneau-config { opacity: .6; pointer-events: none; user-select: none; }
/* Éditeur d'offre (formulaire simple) : on neutralise les champs, pas les liens. */
form.est-verrouille input, form.est-verrouille textarea, form.est-verrouille select,
form.est-verrouille .support-picker, form.est-verrouille .champ-media .buttons,
form.est-verrouille .checkbox { opacity: .6; pointer-events: none; }

/* Toast de confirmation (enregistrement async). */
.editeur-toast {
    position: fixed;
    right: 1rem; bottom: 1rem;
    z-index: 60;
    padding: .65rem 1rem;
    border-radius: 6px;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    opacity: 1;
    transition: opacity .4s, transform .4s;
}
.editeur-toast.is-success { background: #48c78e; }
.editeur-toast.is-danger  { background: #f14668; }
.editeur-toast.parti { opacity: 0; transform: translateY(8px); }

/* Drag & drop : poignée + retours visuels. */
.drag-poignee {
    cursor: grab;
    color: #b5b5b5;
    user-select: none;
    padding: 0 .15rem;
}
.drag-poignee:active { cursor: grabbing; }
.offre-item[draggable="true"] { cursor: grab; }
.offre-lib { flex: 1; }
.drag-source { opacity: .45; }
.groupe-bloc.drag-over { outline: 2px dashed #3273dc; outline-offset: 2px; }
.offre-item.drag-over { box-shadow: 0 -2px 0 #3273dc; }

/* Éditeur de groupes de liens. */
.lien-groupe {
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: .75rem;
    margin-bottom: 1rem;
    background: #fafafa;
}
.lien-groupe[draggable="true"] { cursor: grab; }
.lien-groupe.drag-over { outline: 2px dashed #3273dc; outline-offset: 2px; }
.lien-groupe-head { display: flex; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.lien-groupe-head .lien-groupe-titre { flex: 1; }
.lien-liste { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }
.lien-bloc {
    border: 1px solid #eee;
    border-radius: 6px;
    padding: .6rem .7rem;
    background: #fff;
}
/* En-tête d'un lien : ligne cliquable (chevron + résumé + suppression). */
.lien-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; cursor: pointer; }
.lien-head-titre {
    flex: 1; font-size: .8rem; font-weight: 600; color: #555;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lien-chevron { color: #999; transition: transform .15s ease; }
.lien-bloc:not(.est-replie) .lien-chevron { transform: rotate(90deg); }
/* Replié : on masque le corps et on colle l'en-tête sur une seule ligne. */
.lien-bloc.est-replie .lien-head { margin-bottom: 0; }
.lien-bloc.est-replie .lien-corps { display: none; }
/* Aperçu + sélecteur de proportions côte à côte (ratio à droite de la photo). */
.champ-media-row { display: flex; align-items: flex-start; gap: .75rem; }
/* Sélecteur de proportions : seulement quand une image est présente. */
.lien-ratio { margin: 0; }
.champ-media:not(.a-image) .lien-ratio { display: none; }

/* Éditeur de FAQ d'une page : recherche + sélection. */
.faq-recherche { position: relative; }
.faq-results {
    display: none;
    position: absolute;
    z-index: 40;
    left: 0; right: 0;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
    max-height: 260px;
    overflow-y: auto;
}
.faq-results.is-ouvert { display: block; }
.faq-result { padding: .45rem .75rem; cursor: pointer; font-size: .9rem; }
.faq-result:hover { background: #f0f4ff; }
.faq-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .55rem;
    margin-bottom: .35rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
}
.faq-item[draggable="true"] { cursor: grab; }
.faq-item.drag-over { box-shadow: 0 -2px 0 #3273dc; }
.faq-item-lib { flex: 1; font-size: .9rem; }

/* Mini éditeur WYSIWYG (champWysiwyg). */
.wysiwyg-toolbar { margin-bottom: 0; }
.wysiwyg-zone {
    border: 1px solid #dbdbdb;
    border-radius: 0 4px 4px 4px;
    padding: .6rem .75rem;
    min-height: 7rem;
    background: #fff;
    overflow-wrap: anywhere;
}
.wysiwyg-zone:focus { outline: none; border-color: #3273dc; box-shadow: 0 0 0 .125em rgba(50,115,220,.25); }
.wysiwyg-zone:empty::before { content: attr(data-placeholder); color: #b5b5b5; }
/* Le textarea de code porte la classe Bulma .textarea (display:block) qui masque
   l'attribut [hidden] ; on force le masquage quand il n'est pas en mode code. */
.wysiwyg-code[hidden] { display: none; }
.wysiwyg-code { border-radius: 0 4px 4px 4px; }

/* =====================================================================
   Tooltip CSS pur (façon balloon.css) — sur tout élément [data-tooltip].
   Utilisé notamment sur les boutons d'action des listes (.table). Le texte
   provient de l'attribut data-tooltip (le title natif est déplacé par JS
   pour éviter une double infobulle). data-tooltip-pos="left" aligne la bulle
   sur le bord droit de l'élément (boutons en bout de ligne, anti-débordement).
   ===================================================================== */
[data-tooltip] { position: relative; }
[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 40;
}
/* Bulle */
[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2430;
    color: #fff;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    padding: .35rem .55rem;
    border-radius: 5px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
}
/* Flèche */
[data-tooltip]::before {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2430;
}
[data-tooltip]:hover::before,  [data-tooltip]:hover::after,
[data-tooltip]:focus-visible::before, [data-tooltip]:focus-visible::after { opacity: 1; }

/* Variante alignée à droite : la bulle s'ouvre vers la gauche. */
[data-tooltip-pos="left"]::after  { left: auto; right: 0;    transform: none; }
[data-tooltip-pos="left"]::before { left: auto; right: 11px; transform: none; }

/* Tooltip long du champ de recherche du menu : multi-lignes, aligné à gauche,
   et ouvert SOUS le champ (le menu est tout en haut, pas de place au-dessus). */
.dash-search[data-tooltip]::after {
    left: 0; right: auto;
    bottom: auto; top: calc(100% + 7px);
    transform: none;
    white-space: normal;
    width: 210px;
    text-align: left;
}
.dash-search[data-tooltip]::before {
    left: 24px; transform: none;
    bottom: auto; top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: #1f2430;
}

/* Titre d'offre sous le nom du support (liste des commandes) : discret et tronqué. */
.cmd-offre-titre {
    display: block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .68rem;
    color: #8a8f99;
}

/* Bascule active/inactive d'une offre (liste) : pas de bouton, juste un gros picto
   « switch » coloré (vert = active, rouge = inactive), sans contour ni marges. */
.offre-switch.button {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    height: auto;
}
.offre-switch.button .icon { font-size: 1.6rem; height: auto; width: auto; }

/* Ligne d'offre inactive (liste des offres) : légèrement atténuée. Le switch et
   les boutons d'action restent pleinement lisibles. */
tr.offre-inactive > td:not(:first-child):not(:last-child),
tr.ligne-inactive > td:not(:first-child):not(:last-child) { opacity: .55; }

/* ===== Mode embarqué (?embed=1) : contenu nu, pour iframe/modale ===== */
.dash-embed { background: #fff; }
.dash-embed-main { padding-bottom: 0; }

/* ===== Modale d'édition d'offre (iframe) ===== */
.offre-modale .modal-content,
.offre-modale .offre-modale-boite {
    position: relative;
    width: 96vw;
    max-width: 1100px;
    height: 92vh;
    margin: 0;
    overflow: visible;
}
.offre-modale-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .35);
}
.offre-modale-fermer {
    position: absolute;
    top: -.75rem;
    right: -.75rem;
    z-index: 2;
    background: rgba(10, 10, 10, .7);
}
@media (max-width: 768px) {
    .offre-modale .modal-content,
    .offre-modale .offre-modale-boite { width: 100vw; height: 100vh; max-width: none; }
    .offre-modale-iframe { border-radius: 0; }
    .offre-modale-fermer { top: .5rem; right: .5rem; }
}
