/*
 * SP UI — Composants d'interface partagés
 * spModal, spConfirm — disponibles pour tous les modules SP
 *
 * @since  3.1.0
 * @since  3.4.18 Correctif impression : classe body.sp-ui-impression-actif
 *                plutôt que :has(#sp-ui-impression) — voir index.php
 * @author Christian Pelletier
 */


/* Toast : styles inline dans sp-os-ui.js (portage fidèle v2) */


/* ── Modal ───────────────────────────────────────────────────────────────────*/

#sp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 99999;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

#sp-modal-overlay.sp-modal--actif {
    display: flex;
}

#sp-modal {
    background: rgba(15,15,25,0.96);
    border: 0.5px solid var(--sp-red, #e31837);
    border-radius: 12px;
    width: 100%;
    max-width: 740px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    overflow: hidden;
    margin: auto;
    color: #fff;
}

#sp-modal-header {
    padding: 24px 36px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

#sp-modal-titre {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

#sp-modal-close {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.7;
    min-height: unset !important;
    transition: opacity 0.15s;
}

#sp-modal-close:hover { opacity: 1; }

#sp-modal-body {
    padding: 24px 36px;
    max-height: 65vh;
    overflow-y: auto;
}

#sp-modal-footer {
    padding: 16px 36px 28px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* Contenu de carte affiché comme contenu libre dans la modale : les textes
   gris (.sp-card-meta, .sp-card-detail, .sp-vide) sont calibrés en
   var(--sp-gray) pour un fond blanc et deviennent illisibles sur le fond
   sombre de la modale (#sp-modal). Éclaircis ici, dans le contexte de la
   modale seulement — le rendu normal en page (fond blanc) n'est pas touché. */
#sp-modal-body .sp-card-meta,
#sp-modal-body .sp-card-detail,
#sp-modal-body .sp-vide,
#sp-modal-body .sp-ga-tem-extrait {
    color: #FFFFFFBB;
}

/* Boutons modal */
.sp-modal-btn {
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none !important;
    transition: opacity 0.15s;
    min-height: unset !important;
    line-height: 1.4;
}

.sp-modal-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.sp-modal-btn-primary {
    background: var(--sp-red, #e31837) !important;
    color: #fff !important;
}

.sp-modal-btn-success {
    background: #16a34a !important;
    color: #fff !important;
}

.sp-modal-btn-ghost {
    background: rgba(255,255,255,.08) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.18) !important;
}

.sp-modal-btn-danger {
    background: rgba(220,38,38,.15) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(220,38,38,.3) !important;
}

/* Sections dans le corps */
.sp-modal-section {
    margin-bottom: 20px;
}

.sp-modal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,.45);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sp-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    font-size: 0.875rem;
    color: rgba(255,255,255,.88);
}

.sp-modal-grid span strong {
    color: rgba(255,255,255,.5);
    font-weight: 600;
    margin-right: 4px;
}

.sp-modal-grid-full {
    grid-column: 1 / -1;
}

.sp-modal-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.sp-modal-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sp-modal-badge.oui { background: rgba(220,252,231,.15); color: #86efac; }
.sp-modal-badge.non { background: rgba(255,255,255,.08); color: rgba(255,255,255,.35); }

/* Champs dans le modal */
.sp-modal-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,.5);
    margin-bottom: 4px;
}

.sp-modal-input,
.sp-modal-select,
.sp-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.15) !important;
    border-radius: 6px;
    color: #fff;
    font-size: 0.875rem;
}

.sp-modal-input:focus,
.sp-modal-select:focus,
.sp-modal-textarea:focus {
    outline: none;
    border-color: var(--sp-blue, #2563eb) !important;
}

.sp-modal-action-section {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.sp-modal-action-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255,255,255,.6);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sp-modal-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
}

.sp-modal-full { grid-column: 1 / -1; }

.sp-modal-action-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sp-modal-spinner {
    font-size: 0.85rem;
    color: rgba(255,255,255,.6);
    font-style: italic;
}

/* Mobile */
@media (max-width: 540px) {
    .sp-modal-grid,
    .sp-modal-action-grid { grid-template-columns: 1fr; }
    #sp-modal-overlay { padding: 0; }
    #sp-modal { border-radius: 0; min-height: 100dvh; }
    #sp-modal-body { padding: 16px 20px; max-height: none; }
    #sp-modal-header { padding: 18px 20px 14px; }
    #sp-modal-footer { padding: 14px 20px 24px; }
}


/* ─── Modal de confirmation d'inscription ────────────────────────────────────
 *
 * Bloc de détails affiché dans spModal() après une inscription réussie.
 * Réutilisable pour tout module affichant une confirmation d'activité.
 *
 * @since  3.2.31
 */
.sp-modal-confirmation-details {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--sp-rouge);
    border-radius: 4px;
    line-height: 1.7;
    font-size: 0.95rem;
}


/* ─── Composants réutilisables — portés du v2 ────────────────────────────────
 *
 * Disponibles pour tous les modules SP.
 * Les styles spécifiques à un module restent dans ce module.
 *
 * @since  3.1.0
 * @author Christian Pelletier
 */


/* ── Carte générique ─────────────────────────────────────────────────────── */

.sp-card {
    background: #ffffff;
    border: 1px solid var(--sp-border);
    border-top: 3.5px solid var(--sp-red);
    border-radius: var(--sp-radius);
    padding: 24px;
    transition: box-shadow 0.25s ease;
    position: relative;
}

.sp-card:hover {
    box-shadow: 0 4px 20px rgba(227, 24, 55, 0.2);
    border-color: var(--sp-red);
}

/* Variante non cliquable — pour l'affichage de données (ex. cartes de
   résultats de sondage) plutôt que pour la navigation.
   La distinction avec une carte cliquable tient à deux choses : l'accent
   rouge en haut et l'effet hover. Une carte statique n'a ni l'un ni
   l'autre — le fond et le reste de l'habillage restent identiques à
   .sp-card. */
.sp-card--statique {
    cursor: default;
    border-top-color: var(--sp-border);
}
.sp-card--statique:hover {
    box-shadow: none;
    border-color: var(--sp-border);
}

.sp-card-past { opacity: 0.65; }

.sp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.sp-card-titre {
    margin: 0;
    font-size: 1.1rem;
    color: var(--sp-red);
    line-height: 1.4;
}

.sp-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--sp-gray);
    margin-bottom: 12px;
}

.sp-meta-item { display: flex; align-items: center; gap: 4px; }

.sp-card-detail {
    color: var(--sp-gray);
    font-size: 0.93rem;
    line-height: 1.65;
    margin: 0 0 16px;
}

.sp-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}


/* ── Boutons ─────────────────────────────────────────────────────────────── */

.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--sp-tap-min);
    padding: 9px 20px 11px;
    border: none;
    border-radius: var(--sp-radius);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

/* ── Reset GeneratePress ─────────────────────────────────────────────────── */
/* Scopé à #sp-os-shell pour ne pas écraser les boutons GP hors contexte SP */

#sp-os-shell .sp-btn {
    background-color: transparent;
    color: var(--sp-dark);
}

/* Primaire — rouge SP */
.sp-btn--primaire,
.sp-btn-primary {
    background: var(--sp-red) !important;
    color: #fff !important;
}
.sp-btn--primaire:hover,
.sp-btn--primaire:visited,
.sp-btn-primary:hover {
    background: var(--sp-red-hover) !important;
    color: #fff !important;
}

/* Secondaire */
.sp-btn--secondaire,
.sp-btn-secondary {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid var(--sp-border) !important;
}
.sp-btn--secondaire:hover,
.sp-btn-secondary:hover { background: #e2e8f0 !important; }

/* Contour rouge */
.sp-btn--contour {
    background: transparent !important;
    color: var(--sp-red) !important;
    border: 2px solid var(--sp-red) !important;
}
.sp-btn--contour:hover { background: #fff0f2 !important; }

/* Inscrit — outline rouge (état actif) */
.sp-btn--inscrit {
    background: #fff !important;
    color: var(--sp-red) !important;
    border: 2px solid var(--sp-red) !important;
}
.sp-btn--inscrit:hover { background: #fff0f2 !important; }

/* Paiement en attente — inscription réservée, paiement non reçu */
.sp-btn--paiement-attente {
    background: #fef9c3 !important;
    color: #92400e !important;
    border: 2px solid #fde68a !important;
}
.sp-btn--paiement-attente:hover { background: #fef08a !important; border-color: #facc15 !important; }

/* Neutre */
.sp-btn--neutre {
    background: var(--sp-border) !important;
    color: var(--sp-dark) !important;
}
.sp-btn--neutre:hover { background: #cbd5e1 !important; }

/* Danger — suppression, action destructrice */
.sp-btn--danger,
.sp-btn-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}
.sp-btn--danger:hover,
.sp-btn-danger:hover {
    background: #fecaca !important;
    border-color: #f87171 !important;
}

/* Warning — maintenance */
.sp-btn--warning {
    background: #fff7ed !important;
    color: #c2410c !important;
    border: 1px solid #fed7aa !important;
}
.sp-btn--warning:hover {
    background: #ffedd5 !important;
    border-color: #fb923c !important;
}

/* Maintenance active — terminer */
.sp-btn--maintenance-actif {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
}
.sp-btn--maintenance-actif:hover { background: #fde68a !important; }

/* Gestionnaire de modules — bouton Maintenance (state: inactif) */
.btn-maintenance-module:not(.sp-btn--maintenance-actif) {
    background: #fff7ed !important;
    color: #c2410c !important;
    border: 1px solid #fed7aa !important;
}
.btn-maintenance-module:not(.sp-btn--maintenance-actif):hover {
    background: #ffedd5 !important;
    border-color: #fb923c !important;
    color: #9a3412 !important;
}

/* Pleine largeur */
.sp-btn--pleine-largeur { width: 100%; }

/* Petit */
.sp-btn--petit,
.sp-btn--sm {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 500;
}

/* Désactivé */
.sp-btn:disabled,
.sp-btn--desactive {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    border: none;
    pointer-events: none;
}


/* ── Badges ──────────────────────────────────────────────────────────────── */

.sp-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sp-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sp-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
}

.sp-badge-passe   { background: var(--sp-light); color: var(--sp-gray); }
.sp-badge-complet { background: #fee2e2; color: #dc2626; }
.sp-badge-ok      { background: #dcfce7; color: #15803d; }
.sp-badge-alerte  { background: #fef9c3; color: #a16207; }
.sp-badge-info    { background: #eff6ff; color: #1e40af; }

/* Badge "reporté" */
.sp-badge-reporte,
.sp-badge-reporte-pub {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 20px;
    vertical-align: middle;
    white-space: nowrap;
}


/* ── Chips ───────────────────────────────────────────────────────────────── */

.sp-chip {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}

.sp-chip-ok,
.sp-os-chip-ok   { background: rgba(29,158,117,0.15); color: #0f6e56; }
.sp-chip-warn,
.sp-os-chip-warn { background: rgba(239,159,39,0.15);  color: #854f0b; }
.sp-chip-full,
.sp-os-chip-full { background: rgba(226,75,74,0.12);   color: #a32d2d; }
.sp-chip-info,
.sp-os-chip-info { background: rgba(55,138,221,0.15);  color: #185fa5; }


/* ── Avatar ──────────────────────────────────────────────────────────────── */

.sp-avatar,
.sp-os-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    border-radius: 50%;
    background: #ede8f5;
    color: var(--sp-bordeaux);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sp-avatar-blue,
.sp-os-avatar-blue {
    background: rgba(55,138,221,0.15);
    color: #185fa5;
}

/* Modificateurs — en-têtes de tableaux de bord */
.sp-avatar--grand {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    max-width: 42px;
    max-height: 42px;
    font-size: 1rem;
    font-weight: 700;
}

.sp-avatar--rouge {
    background: var(--sp-red);
    color: #fff;
}


/* ── Barre de progression ────────────────────────────────────────────────── */

.sp-bar-wrap,
.sp-places-bar-bg {
    height: 5px;
    background: var(--sp-light);
    border-radius: 99px;
    overflow: hidden;
}

.sp-bar-fill,
.sp-places-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--sp-red);
    transition: width 0.4s ease;
}

.sp-bar-fill--ok     { background: #1d9e75; }
.sp-bar-fill--alerte { background: #e37018; }
.sp-bar-fill--complet { background: #c0c0c0; }

.sp-places-ok       { background: #dcfce7; color: #15803d; }
.sp-places-alerte   { background: #fef9c3; color: #a16207; }
.sp-places-critique { background: #fee2e2; color: #dc2626; }


/* ── Messages feedback ───────────────────────────────────────────────────── */

.sp-msg {
    margin-top: 10px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.88rem;
}

.sp-msg-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.sp-msg-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.sp-msg-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.sp-msg-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }


/* ── Consentement (case à cocher encadrée) ──────────────────────────────── */

.sp-consentement {
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--sp-light);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
}

.sp-consentement label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.875rem;
    color: var(--sp-dark);
    cursor: pointer;
    line-height: 1.5;
    font-weight: 400;
}

.sp-consentement input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--sp-red);
}


/* ── Aide / note ─────────────────────────────────────────────────────────── */

.sp-aide {
    font-size: 0.85rem;
    color: var(--sp-gray);
    line-height: 1.5;
    margin: 0 0 16px;
}

.sp-vide {
    font-size: 0.9rem;
    color: var(--sp-gray);
    font-style: italic;
    padding: 8px 0;
}

/* Message affiché quand une liste publique est vide */
.sp-liste-vide {
    text-align: center;
    color: var(--sp-gray);
    font-style: italic;
    padding: 2rem 1rem;
}


/* ── Liste titre + badge ─────────────────────────────────────────────────
   Pour remplacer une colonne de sp-card quand la liste risque de devenir
   longue (ex. entrées "Terminé" dans un tableau kanban). Une simple ligne
   avec le titre à gauche et un badge à droite, au lieu d'une carte complète.
   Nommée .sp-liste-titre-badge (et non .sp-liste-compacte) pour éviter la
   collision avec .sp-liste-compacte, déjà utilisée par sp-gestion-activites
   et sp-gestion-evenements pour un tout autre composant (liste dépliable). */

.sp-liste-titre-badge {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-liste-titre-badge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sp-border);
    font-size: 0.88rem;
}

.sp-liste-titre-badge-item:last-child {
    border-bottom: none;
}

/* Variante cliquable — la ligne ouvre une modale de détail */
.sp-liste-titre-badge-item--cliquable {
    cursor: pointer;
    border-radius: var(--sp-radius);
}

.sp-liste-titre-badge-item--cliquable:hover {
    background: var(--sp-light);
}

/* ── Utilitaire générique : zone cliquable ouvrant une modale de détail ─────
   Réutilisable partout où un bloc de contenu (carte, ligne, section) doit
   indiquer visuellement qu'un clic ouvrira le détail complet dans spModal. */

.sp-cliquable {
    cursor: pointer;
    border-radius: var(--sp-radius);
    transition: background 0.15s ease;
}

.sp-cliquable:hover {
    background: var(--sp-light);
}

/* ── Utilitaire générique : troncature de texte multi-lignes ────────────────
   Affiche un aperçu limité à un nombre de lignes (3 par défaut) avec « … ».
   Le texte complet reste dans le DOM — utile pour les aperçus qui s'ouvrent
   en entier dans une modale (spModal). Ajuster avec style="--sp-clamp:2". */

.sp-texte-tronque {
    display: -webkit-box;
    -webkit-line-clamp: var(--sp-clamp, 3);
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-texte-tronque-indice {
    display: block;
    margin-top: 4px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--sp-rouge, #e31837);
}

.sp-liste-titre-badge-titre {
    color: var(--sp-texte);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-acces-refuse {
    color: var(--sp-gray);
    font-style: italic;
    padding: 20px 0;
}

/* ── Barre de recherche / filtre ─────────────────────────────────────────── */

.sp-recherche-barre {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.sp-recherche-barre__icone {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--sp-gray);
    pointer-events: none;
    line-height: 1;
}

.sp-recherche-barre__champ {
    padding: 8px 12px 8px 32px !important;
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    color: var(--sp-dark);
    -webkit-appearance: none;
    appearance: none;
}

.sp-recherche-barre__champ::-webkit-search-decoration,
.sp-recherche-barre__champ::-webkit-search-cancel-button,
.sp-recherche-barre__champ::-webkit-search-results-button,
.sp-recherche-barre__champ::-webkit-search-results-decoration {
    display: none;
}

.sp-recherche-barre__champ:focus {
    outline: none;
    border-color: var(--sp-red);
    box-shadow: 0 0 0 2px rgba(227,24,55,0.12);
}

.sp-recherche-barre__champ::placeholder {
    color: var(--sp-gray);
}

/* Résultat vide après filtrage */
.sp-os__groupe--vide {
    display: none;
}


/* ── Inputs ──────────────────────────────────────────────────────────────── */

.sp-input,
.sp-select,
.sp-textarea {
    padding: 8px 12px;
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
}

.sp-input:focus,
.sp-select:focus,
.sp-textarea:focus {
    outline: none;
    border-color: var(--sp-red);
    box-shadow: 0 0 0 2px rgba(227,24,55,0.12);
}

.sp-textarea { resize: vertical; }


/* ── Formulaires ─────────────────────────────────────────────────────────── */

.sp-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.sp-form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sp-dark);
}

.sp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.sp-col-full { grid-column: 1 / -1; }

.sp-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}


/* ── Panel ───────────────────────────────────────────────────────────────── */

.sp-panel {
    background: var(--sp-light);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.sp-panel h3 { margin: 0 0 16px; }
.sp-panel p  { margin: 0; }


/* ── Tableau ─────────────────────────────────────────────────────────────── */

.sp-table-wrapper { overflow-x: auto; margin-top: 8px; }

.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sp-table th {
    background: var(--sp-light);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--sp-gray);
    border-bottom: 2px solid var(--sp-border);
    white-space: nowrap;
}

.sp-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--sp-light);
    color: var(--sp-dark);
    vertical-align: top;
}

.sp-table tr:hover td { background: #fafafa; }


/* ── Ligne de tableau expandable (accordéon en ligne) ───────────────────────
   Permet d'ouvrir une ligne de détail sous une ligne de tableau normale,
   par exemple pour montrer les liens trackés d'un envoi d'infolettre.

   Usage :
     <tr class="sp-ligne-expandable" data-cle="...">
       <td><span class="sp-expand-chevron">▸</span></td>
       ...
     </tr>
     <tr class="sp-detail-ligne" style="display:none;">
       <td colspan="N"><div class="sp-detail-contenu">...</div></td>
     </tr>
   Ajouter la classe "sp-est-ouverte" sur <tr class="sp-ligne-expandable"> à
   l'ouverture pour faire pivoter le chevron.

   @since 3.4.2
   ─────────────────────────────────────────────────────────────────────── */

.sp-ligne-expandable { cursor: pointer; }
.sp-ligne-expandable:hover td { background: #fafafa; }

.sp-expand-chevron {
    display: inline-block;
    color: var(--sp-gray);
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}

.sp-ligne-expandable.sp-est-ouverte .sp-expand-chevron {
    transform: rotate(90deg);
    color: var(--sp-red);
}

.sp-detail-ligne td {
    padding: 0 !important;
    border-bottom: 1px solid var(--sp-border);
}

.sp-detail-contenu {
    background: var(--sp-light);
    padding: 16px 20px;
}

.sp-detail-contenu .sp-table,
.sp-detail-contenu .sp-tableau { background: #fff; }

.sp-detail-vide {
    color: var(--sp-gray);
    font-style: italic;
    padding: 4px 0;
    margin: 0;
}

.sp-detail-chargeur {
    text-align: center;
    padding: 12px;
    color: var(--sp-gray);
}


.sp-td-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}


/* ── Maintenance ─────────────────────────────────────────────────────────── */

.sp-maintenance {
    text-align: center;
    padding: 60px 20px;
}

.sp-maintenance__icone {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

.sp-maintenance__titre {
    color: var(--sp-dark);
    margin: 0 0 12px;
}

.sp-maintenance__texte {
    color: var(--sp-gray);
    font-size: 0.95rem;
    line-height: 1.65;
}


/* ── Cloche de notifications ─────────────────────────────────────────────── */
/*
 * Bouton cloche + badge + panneau dropdown d'historique.
 * Utilisé dans SP OS. Potentiellement réutilisable dans d'autres shells.
 *
 * Structure :
 *   <div class="sp-os__cloche-wrap">
 *     <button class="sp-notif-cloche" id="sp-notif-cloche">🔔
 *       <span class="sp-notif-cloche__badge" id="sp-notif-cloche-badge"></span>
 *     </button>
 *     <div class="sp-notif-panneau" id="sp-notif-panneau">…</div>
 *   </div>
 */

.sp-notif-cloche {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: 4px;
    user-select: none;
    transition: transform 0.15s;
}

.sp-notif-cloche:hover {
    transform: scale(1.12);
}

.sp-notif-cloche--nouveau {
    animation: sp-cloche-sonnerie 0.5s ease;
}

@keyframes sp-cloche-sonnerie {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(-18deg); }
    40%  { transform: rotate(18deg); }
    60%  { transform: rotate(-12deg); }
    80%  { transform: rotate(8deg); }
    100% { transform: rotate(0deg); }
}

.sp-notif-cloche__badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--sp-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

.sp-notif-cloche__badge--vide {
    display: none;
}

/* ── Panneau dropdown ────────────────────────────────────────────────────── */

/* Le panneau se positionne par rapport au wrap, pas à la cloche.
   La cloche est un <span role="button"> — pas d'override de position nécessaire. */
.sp-os__cloche-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sp-notif-panneau {
    display: none !important;
    position: fixed;
    width: 360px;
    max-height: 500px;
    background: #fff;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
    z-index: 99999;
    flex-direction: column;
    overflow: hidden;
}

.sp-notif-panneau--ouvert {
    display: flex !important;
}

.sp-notif-panneau__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
}

.sp-notif-panneau__titre {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--sp-dark);
}

.sp-notif-panneau__tout-lire {
    background: none !important;
    color: var(--sp-blue) !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    min-height: unset !important;
    box-shadow: none !important;
    text-decoration: none !important;
    transition: color 0.15s;
}

.sp-notif-panneau__tout-lire:hover {
    background: none !important;
    color: var(--sp-blue-hover, #1a56db) !important;
    text-decoration: underline !important;
}

.sp-notif-panneau__liste {
    overflow-y: auto;
    flex: 1;
}

.sp-notif-panneau__vide {
    padding: 20px 16px;
    font-size: 0.875rem;
    color: var(--sp-gray);
    text-align: center;
    margin: 0;
}

.sp-notif-panneau__pied {
    padding: 10px 16px;
    border-top: 1px solid var(--sp-border);
    flex-shrink: 0;
}

.sp-notif-panneau__pied a {
    font-size: 0.8rem;
    color: var(--sp-blue);
    text-decoration: none;
}

.sp-notif-panneau__pied a:hover {
    text-decoration: underline;
}

/* ── Items de notification ───────────────────────────────────────────────── */

.sp-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sp-border);
    position: relative;
    transition: background 0.12s;
}

.sp-notif-item:last-child {
    border-bottom: none;
}

.sp-notif-item:hover {
    background: #f8fafc;
}

.sp-notif-item--non-lu {
    background: #f0f7ff;
}

.sp-notif-item--non-lu:hover {
    background: #e6f0fb;
}

.sp-notif-item__icone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: #e8f0fe;
}

.sp-notif-item__corps {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.sp-notif-item__titre {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--sp-dark);
    line-height: 1.3;
}

.sp-notif-item__message {
    font-size: 0.82rem;
    color: var(--sp-gray);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-notif-item__heure {
    font-size: 0.8rem;
    color: var(--sp-gray);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

.sp-notif-item__point {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sp-blue);
    flex-shrink: 0;
}

/* Couleur de l'icône selon le type */
.sp-notif-item--valorisation .sp-notif-item__icone {
    background: #e8f5e9;
    color: #16a34a;
}

.sp-notif-item--intervention .sp-notif-item__icone {
    background: #fff3e0;
    color: #d97706;
}

.sp-notif-item--module .sp-notif-item__icone {
    background: #e3f2fd;
    color: #1565c0;
}



/* ── Zone de dépôt (dropzone) ────────────────────────────────────────────── */
/*
 * Utilisée dans tout module permettant le dépôt de fichiers par glisser-déposer.
 *
 * Structure :
 *   <div class="sp-dropzone">
 *     <div class="sp-dropzone__icone">📎</div>
 *     <div class="sp-dropzone__texte">
 *       <strong>Titre</strong>
 *       <span>Sous-titre</span>
 *       <em>Note secondaire</em>
 *     </div>
 *   </div>
 */

.sp-dropzone {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin-top: 20px;
    margin-bottom: 24px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.sp-dropzone:hover,
.sp-dropzone--dragover {
    border-color: var(--sp-red);
    background: #fff5f5;
}
.sp-dropzone--analyse {
    opacity: 0.75;
    pointer-events: none;
    border-color: var(--sp-red);
    background: #fef2f2;
}
.sp-dropzone__icone {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.sp-dropzone__texte {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.sp-dropzone__texte strong {
    color: #1e293b;
    font-size: 0.9rem;
}
.sp-dropzone__texte span {
    color: #64748b;
    font-size: 0.82rem;
}
.sp-dropzone__texte em {
    color: #94a3b8;
    font-size: 0.78rem;
    font-style: normal;
}


/* ── Bannière de maintenance — shortcode inline ──────────────────────────── */
/*
 * Remplace le rendu d'un shortcode lorsque le module est en maintenance.
 * Inspiré visuellement de la dropzone, mais en jaune (warning).
 *
 * Structure :
 *   <div class="sp-maintenance-module">
 *     <div class="sp-maintenance-module__icone">🔧</div>
 *     <p class="sp-maintenance-module__titre">…</p>
 *     <p class="sp-maintenance-module__desc">…</p>
 *   </div>
 */

.sp-maintenance-module {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin: 16px 0;
    border: 2px dashed #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
}
.sp-maintenance-module__icone {
    font-size: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}
.sp-maintenance-module__texte {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.sp-maintenance-module__titre {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #92400e;
    margin: 0;
}
.sp-maintenance-module__desc {
    display: block;
    font-size: 0.82rem;
    color: #b45309;
    margin: 0;
    line-height: 1.5;
}


/* ── Toggle switch (sp-toggle) @since 3.2.32 ────────────────────────────────
   Interrupteur on/off réutilisable dans tous les modules.
   Usage : <label class="sp-toggle"><input type="checkbox"><span class="sp-toggle__slider"></span></label>
   @author Christian Pelletier */
.sp-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.sp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.sp-toggle__slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    cursor: pointer;
    transition: background .2s;
}
.sp-toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.sp-toggle input:checked + .sp-toggle__slider {
    background: var(--sp-red, #e31837);
}
.sp-toggle input:checked + .sp-toggle__slider::before {
    transform: translateX(20px);
}
.sp-toggle input:focus-visible + .sp-toggle__slider {
    outline: 2px solid var(--sp-red, #e31837);
    outline-offset: 2px;
}


/* ── Bandeau de vote ─────────────────────────────────────────────────────── */

.sp-vote-bandeau {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px 28px;
    margin: 24px 0;
}

.sp-vote-bandeau__entete {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.sp-vote-bandeau__titre {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.sp-vote-bandeau__sous-titre {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-top: 2px;
}

.sp-vote-bandeau__liste {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-vote-bandeau__item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.sp-vote-bandeau__nom {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 140px;
}

.sp-vote-bandeau__score {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sp-vote-bandeau__score-pour   { color: #16a34a; }
.sp-vote-bandeau__score-contre { color: #dc2626; }

.sp-vote-bandeau__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.sp-vote-bandeau__proprio {
    font-size: 0.8rem;
    color: #94a3b8;
    font-style: italic;
}

.sp-vote-bandeau__footer {
    margin-top: 16px;
    text-align: right;
}

.sp-vote-bandeau__lien {
    font-size: 0.82rem;
    color: #94a3b8;
    text-decoration: none;
}

.sp-vote-bandeau__lien:hover {
    color: #e31837;
    text-decoration: underline;
}

.sp-vote-bandeau__vide {
    font-size: 0.9rem;
    color: #94a3b8;
    text-align: center;
    padding: 12px 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .sp-form-grid       { grid-template-columns: 1fr; }
    .sp-card-actions    { flex-direction: column; }
    .sp-btn             { width: 100%; text-align: center; }
    .sp-form-actions    { flex-direction: column; }
    .sp-vote-bandeau__item {
        flex-direction: column;
        align-items: flex-start;
    }
    .sp-vote-bandeau__actions { width: 100%; }
}

/* ── Image cliquable (sp-ads-web, sp-ads-slider, sp-ads-distant) ─────────── */
/* Appliqué sur un <a> ou <div> contenant une image pub. */

.sp-img-cliquable {
    display: block;
    cursor: pointer;
    border-radius: var(--sp-radius, 8px);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.sp-img-cliquable:hover {
    box-shadow: 0 4px 20px rgba(227, 24, 55, 0.2);
    transform: translateY(-2px);
}

.sp-img-cliquable img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--sp-radius, 8px);
}

/* ── Slider promotionnel (sp-ads-slider) ─────────────────────────────────── */

.sp-slider {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: var(--sp-radius, 8px);
    margin: 0 0 24px;
    background: var(--sp-light, #f8fafc);
}

.sp-slider__piste {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;         /* Firefox */
    -ms-overflow-style: none;      /* IE/Edge */
}

.sp-slider__piste::-webkit-scrollbar {
    display: none;
}

.sp-slider__item {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
}

/* Navigation : points et flèches */
.sp-slider__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 0 12px;
}

.sp-slider__btn {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--sp-gray, #64748b);
    cursor: pointer;
    padding: 0 6px;
    user-select: none;
    transition: color 0.15s;
}

.sp-slider__btn:hover {
    color: var(--sp-red, #e31837);
}

.sp-slider__dots {
    display: flex;
    gap: 6px;
}

.sp-slider__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sp-border, #e2e8f0);
    cursor: pointer;
    transition: background 0.2s;
}

.sp-slider__dot--actif {
    background: var(--sp-red, #e31837);
}

@media (max-width: 600px) {
    .sp-slider__btn {
        font-size: 1.3rem;
    }
}

/* ── Carte blog (sp-blog) ────────────────────────────────────────────────── */

.sp-card--blog {
    padding: 0 !important;
    overflow: hidden;
    border-top: none;
    border-left: 3.5px solid var(--sp-red);
}

.sp-card--blog .sp-card-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--sp-light);
    margin: 0;
}

.sp-card--blog .sp-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.sp-card--blog:hover .sp-card-image img {
    transform: scale(1.05);
}

.sp-card--blog .sp-card-body {
    padding: 1.25rem;
}

.sp-card--blog .sp-card-titre {
    text-transform: none;
    text-align: left;
}

.sp-card--blog .sp-card-titre a {
    color: var(--sp-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.sp-card--blog:hover .sp-card-titre a {
    color: var(--sp-red);
}

.sp-card--blog .sp-card-detail {
    margin-bottom: 0.75rem;
}

.sp-blog-grille {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* ── Accordéon SP (utilisé par sp-glossaire, sp-faq, et autres) ─────────────
   Classes partagées pour les composants accordéon à onglets.
   @since 3.2.47 - @author Christian Pelletier
   ─────────────────────────────────────────────────────────────────────────── */

.sp-accordeon-wrap {
    color: var(--sp-dark, #2c2c2c);
    margin: 0 0 40px;
}

.sp-accordeon-wrap *,
.sp-accordeon-wrap *::before,
.sp-accordeon-wrap *::after { box-sizing: border-box; }

/* ── En-tête optionnel (mode section unique) ── */
.sp-accordeon-header {
    padding: 28px 0 20px;
    border-bottom: 2px solid var(--sp-red, #c8102e);
    margin-bottom: 12px;
}

.sp-accordeon-tag {
    display: inline-block;
    background: var(--sp-red, #c8102e);
    color: #fff;
    padding: 3px 10px;
    border-radius: 3px;
    margin-bottom: 12px;
}

.sp-accordeon-intro { color: #888; font-style: italic; margin: 0; }

/* ── Compteur ── */
.sp-accordeon-count { color: #888; margin: 16px 0 2px; }

/* ── Onglets ── */
.sp-accordeon-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e8e8e8;
    padding-bottom: 0;
}

.sp-accordeon-tab {
    padding: 10px 18px;
    color: inherit;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    margin-bottom: -2px;
}

.sp-accordeon-tab:hover,
.sp-accordeon-tab.sp-accordeon-tab-active {
    color: #fff;
    background: var(--sp-red, #c8102e);
    border-bottom-color: var(--sp-red, #c8102e);
}

/* ── Panneaux ── */
.sp-accordeon-panel {
    position: absolute;
    visibility: hidden;
    pointer-events: none;
    height: 0;
    overflow: hidden;
}

.sp-accordeon-panel.sp-accordeon-panel-active {
    position: relative;
    visibility: visible;
    pointer-events: auto;
    height: auto;
    overflow: visible;
}

/* ── Entrée accordéon ── */
.sp-accordeon-entry {
    border-bottom: 1px solid #e8e8e8;
    border-left: 3px solid transparent;
    transition: border-left-color 0.2s, background 0.2s;
}

.sp-accordeon-entry:first-of-type { border-top: 1px solid #e8e8e8; }

.sp-accordeon-entry:hover,
.sp-accordeon-entry.sp-accordeon-open {
    border-left-color: var(--sp-red, #c8102e);
    background: #fdf2f4;
}

.sp-accordeon-visible {
    display: flex;
    align-items: flex-start;
    padding: 22px 0 22px 20px;
    cursor: pointer;
    transition: padding-left 0.2s;
}

.sp-accordeon-entry:hover .sp-accordeon-visible,
.sp-accordeon-entry.sp-accordeon-open .sp-accordeon-visible { padding-left: 24px; }

.sp-accordeon-left { flex: 1; }

h2.sp-accordeon-titre {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 8px;
    cursor: pointer;
}

.sp-accordeon-num  { color: #f0c0c8; flex-shrink: 0; }
.sp-accordeon-desc { color: #4a4a4a; line-height: 1.7; margin: 0; }

.sp-accordeon-badge {
    color: var(--sp-red, #c8102e);
    background: #fdf2f4;
    border: 1px solid #f0c0c8;
    border-radius: 3px;
    padding: 1px 7px;
    position: relative;
    top: -2px;
    font-size: 0.85em;
}

.sp-accordeon-arrow {
    color: #888;
    transition: transform 0.25s;
    padding-top: 4px;
    padding-right: 6px;
    flex-shrink: 0;
    user-select: none;
}

.sp-accordeon-entry.sp-accordeon-open .sp-accordeon-arrow { transform: rotate(180deg); }

/* ── Corps accordéon ── */
.sp-accordeon-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 20px 0 24px;
    border-left: 3px solid #f0c0c8;
    background: #fdf2f4;
}

.sp-accordeon-entry.sp-accordeon-open .sp-accordeon-body {
    max-height: 3000px;
    padding: 4px 20px 24px 24px;
}

.sp-accordeon-body p      { color: #4a4a4a; line-height: 1.7; margin: 0 0 8px; }
.sp-accordeon-body ul,
.sp-accordeon-body ol     { margin: 0 0 10px 20px; }
.sp-accordeon-body li     { color: #4a4a4a; line-height: 1.7; margin-bottom: 4px; }
.sp-accordeon-body strong { color: var(--sp-dark, #2c2c2c); }

/* ── Sections internes ── */
.sp-accordeon-section { color: #888; margin: 16px 0 6px; }

/* ── Définition mise en avant ── */
.sp-accordeon-def {
    color: #4a4a4a;
    line-height: 1.7;
    background: #fdf2f4;
    border-left: 3px solid #f0c0c8;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: 0 4px 4px 0;
}

.sp-accordeon-def strong { color: var(--sp-red, #c8102e); }

/* ── Termes reliés ── */
.sp-accordeon-related {
    color: #4a4a4a;
    border-top: 0.5px solid #e8e8e8;
    padding-top: 12px;
    margin-top: 10px;
}

.sp-accordeon-related strong { color: var(--sp-dark, #2c2c2c); }

.sp-accordeon-related a {
    color: var(--sp-red, #c8102e);
    text-decoration: none;
    font-style: italic;
    cursor: pointer;
}

.sp-accordeon-related a:hover { text-decoration: underline; }

/* ── Note de bas de section ── */
.sp-accordeon-note {
    margin-top: 32px;
    padding: 12px 16px;
    background: #fff;
    border-left: 3px solid #e8e8e8;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-style: italic;
    line-height: 1.6;
}

/* ── Pagination (réutilisable dans tous les modules) ── */
.sp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--sp-border);
}

.sp-pagination__bouton {
    border: 1px solid var(--sp-border);
    background: #fff;
    color: var(--sp-gray);
    border-radius: var(--sp-radius);
    padding: 8px 16px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.sp-pagination__bouton:hover:not([disabled]) {
    background: var(--sp-light, #f3f4f6);
    color: var(--sp-dark, #1f2937);
}

.sp-pagination__bouton[disabled] {
    opacity: .4;
    cursor: default;
}

.sp-pagination__info {
    color: var(--sp-gray);
    font-size: .875rem;
}

@media (max-width: 480px) {
    .sp-pagination { flex-wrap: wrap; gap: 10px; }
}


/* ── Onglets génériques (sp-tabs) @since 3.3.4 ──────────────────────────────
   Barre d'onglets réutilisable dans tout module à sections multiples.

   Structure :
     <div class="sp-tabs">
       <button class="sp-tab sp-tab--actif" data-tab="section1">Libellé</button>
       <button class="sp-tab" data-tab="section2">Libellé</button>
     </div>
     <div id="section1">…</div>
     <div id="section2" style="display:none;">…</div>

   @author Christian Pelletier
   ─────────────────────────────────────────────────────────────────────────── */

.sp-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--sp-border);
    flex-wrap: wrap;
}

.sp-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sp-gray);
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sp-tab:hover {
    color: var(--sp-dark);
}

.sp-tab--actif {
    color: var(--sp-red);
    border-bottom-color: var(--sp-red);
}

@media (max-width: 480px) {
    .sp-tab { padding: 10px 14px; font-size: 0.82rem; }
}


/* ── Pièces justificatives (sp-pieces) @since 3.3.4 ─────────────────────────
   Liste de fichiers joints avec état de téléversement.
   Réutilisable dans tout module acceptant des pièces jointes
   (remboursements, réclamations, dossiers, etc.).

   Structure :
     <div class="sp-pieces-liste">
       <div class="sp-piece-item" data-attachment-id="123">
         <span class="sp-piece-icone">📄</span>
         <span class="sp-piece-nom">fichier.pdf</span>
         <span class="sp-piece-spinner">⏳</span>   <!-- retiré après upload -->
         <span class="sp-piece-ok">✅</span>         <!-- affiché après upload -->
         <button class="sp-piece-suppr sp-btn sp-btn--danger sp-btn--petit">✕</button>
       </div>
     </div>

   @author Christian Pelletier
   ─────────────────────────────────────────────────────────────────────────── */

.sp-pieces-liste {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.sp-piece-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sp-light);
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    font-size: 0.875rem;
}

.sp-piece-icone {
    flex-shrink: 0;
}

.sp-piece-nom {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sp-dark);
}

.sp-piece-spinner {
    flex-shrink: 0;
    color: var(--sp-gray);
    font-size: 0.85rem;
}

.sp-piece-ok {
    flex-shrink: 0;
    color: #16a34a;
}

/* Liens vers pièces dans les cartes ou tableaux */
.sp-piece-lien {
    display: inline-block;
    font-size: 0.82rem;
    color: var(--sp-red);
    text-decoration: none;
    margin-right: 8px;
}

.sp-piece-lien:hover {
    text-decoration: underline;
}

.sp-pieces-zone {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}


/* ── Bloc de code / trace technique ─────────────────────────────────────────*/
/* Réutilisable pour tout module affichant une trace, un message d'erreur
   ou un extrait de code (SP Erreurs, futurs outils de diagnostic). */

.sp-code-bloc {
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}


/* ── Tooltip (sp-tooltip) — réutilisable dans tous les modules ──────────────
   Usage : <span class="sp-tooltip" data-tooltip="Texte à afficher">...</span>
   Le texte apparaît au survol et au focus, au-dessus de l'élément par défaut.
   @since 3.3.7 */

.sp-tooltip {
    position: relative;
}

.sp-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--sp-dark, #1e293b);
    color: #fff;
    font-size: 0.78rem;
    font-family: 'Archivo Narrow', sans-serif !important;
    line-height: 1.3;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 100000;
}

.sp-tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--sp-dark, #1e293b);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
    z-index: 100000;
}

.sp-tooltip:hover::after,
.sp-tooltip:hover::before,
.sp-tooltip:focus-visible::after,
.sp-tooltip:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Variante : tooltip qui doit s'afficher sous l'élément (espace insuffisant au-dessus) */
.sp-tooltip--bas::after {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
}
.sp-tooltip--bas::before {
    bottom: auto;
    top: calc(100% + 3px);
    border-top-color: transparent;
    border-bottom-color: var(--sp-dark, #1e293b);
}
.sp-tooltip--bas:hover::after,
.sp-tooltip--bas:focus-visible::after {
    transform: translateX(-50%) translateY(0);
}

/* ── Groupe de cases à cocher en pilules (choix multiples) ──────────────────
   @since 3.4.0
   @updated 3.4.1 — style repris de Mon Profil (case masquée + icône coche
   custom, teinte bleue). L'état visuel réagit à :has(input:checked), donc
   aucun JS n'est requis pour la mise à jour au clic. La classe "is-checked"
   reste supportée pour l'état initial rendu côté serveur et les anciens
   navigateurs sans support de :has().

   Usage :
   <div class="sp-checkbox-group">
     <label class="sp-checkbox-pill">
       <input type="checkbox" name="mon-champ" value="ma-valeur">
       <span>Mon libellé</span>
     </label>
   </div> */
.sp-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sp-checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: #fff;
    border: 1.5px solid var(--sp-border);
    border-radius: 99px;
    font-size: 0.875rem;
    color: var(--sp-dark);
    cursor: pointer;
    line-height: 1.3;
    min-height: var(--sp-tap-min);
    user-select: none;
    transition: background .15s, border-color .15s, color .15s;
}

.sp-checkbox-pill:hover { border-color: var(--sp-blue); }

/* Masquer la case native — l'icône custom ci-dessous la remplace visuellement */
.sp-checkbox-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Carré custom (non coché) */
.sp-checkbox-pill::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 4px;
    border: 2px solid var(--sp-border);
    flex-shrink: 0;
    box-sizing: border-box;
    transition: border-color .15s, background .15s;
}

.sp-checkbox-pill:has(input:checked),
.sp-checkbox-pill.is-checked {
    background: #eff6ff;
    border-color: var(--sp-blue);
    color: var(--sp-blue);
    font-weight: 600;
}

.sp-checkbox-pill:has(input:checked)::before,
.sp-checkbox-pill.is-checked::before {
    border-color: var(--sp-blue);
    background-color: var(--sp-blue);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 10px 8px;
    background-repeat: no-repeat;
    background-position: center;
}


/*
 * Étiquette de version — affichée discrètement en bas de page dans les
 * modules d'administration. Permet d'identifier au premier coup d'œil
 * la version livrée à l'écran, sans ouvrir la console.
 * Utilisation : <div class="sp-version-tag">Nom du module vX.X.X</div>
 * @since 3.4.3
 */
.sp-version-tag {
    margin-top: 16px;
    padding-top: 8px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--sp-gray);
    opacity: 0.7;
}


/* ── Fiche imprimable partagée — window.spImprimerFiche() ────────────────────
   Un seul mécanisme d'impression pour tout SP OS, utilisé par Gestion des
   membres, Mon profil et Inscription manuelle (voir sp-ui/index.php →
   sp_ui_render_overlay() pour la fonction JS).

   #sp-ui-impression est créé dynamiquement au premier appel et rempli juste
   avant window.print() — il reste vide et caché en tout autre temps.

   Deux mesures combinées à l'impression (approche éprouvée sur Mon profil
   depuis la v1.1.19) :
     1. Tout le reste de la page est caché avec visibility:hidden — pas
        display:none — pour ne rien casser ailleurs sur le site.
     2. #sp-ui-impression est sorti du flux normal avec position:fixed —
        contrairement à position:absolute, non affecté par un ancêtre
        position:relative caché quelque part dans le thème.

   .no-print : utilitaire générique pour cacher un élément à l'impression
   sans toucher à son affichage à l'écran (ex. boutons d'action).

   @since 3.4.9 - @author Christian Pelletier
   ─────────────────────────────────────────────────────────────────────── */

#sp-ui-impression { display: none; }

#sp-ui-impression .sp-impression__fiche {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    background: #fff;
    /* #sp-ui-impression est ajouté directement à <body> par JS (voir
       window.spImprimerFiche()) — comme pour .sp-tooltip plus haut, ce
       genre d'élément hors du flux normal n'hérite pas de façon fiable de
       la police configurée. window.spImprimerFiche() copie la police
       RÉELLEMENT utilisée sur la page dans --sp-impression-font-texte —
       plus fiable que --text-font, qui suppose une valeur sauvegardée
       dans le panneau Apparence. Préfixé par #sp-ui-impression pour battre
       en spécificité toute règle du thème.
       @since 3.4.13 - @author Christian Pelletier */
    font-family: var(--sp-impression-font-texte, var(--text-font, 'Archivo Narrow'), sans-serif) !important;
}

#sp-ui-impression .sp-impression__titre {
    margin: 0 0 4px;
    color: #1e293b;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--sp-red, #e31837);
    padding-bottom: 8px;
    font-family: var(--sp-impression-font-titre, var(--heading-font, 'Saira Extra Condensed'), sans-serif) !important;
}

#sp-ui-impression .sp-impression__soustitre {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: #64748b;
}

#sp-ui-impression .sp-impression__soustitre-section {
    margin: 18px 0 6px;
    color: #1e293b;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-family: var(--sp-impression-font-titre, var(--heading-font, 'Saira Extra Condensed'), sans-serif) !important;
}

.sp-impression__fiche table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 4px;
}

.sp-impression__fiche td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.sp-impression__fiche td:first-child {
    color: #64748b;
    width: 200px;
    font-weight: 600;
}

.sp-impression__fiche td:last-child {
    white-space: pre-line;
}

.sp-impression__alerte {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 16px;
    font-size: 13px;
    color: #92400e;
}

.sp-impression__date-emission {
    margin-top: 20px;
    font-size: 0.75rem;
    color: #94a3b8;
}

@media print {
    .no-print {
        display: none !important;
    }

    /* #sp-ui-impression est ajouté comme DERNIER enfant direct de <body>
       par window.spImprimerFiche() (JS). On vide tous les AUTRES enfants
       directs avec display:none — pas seulement visibility:hidden plus
       bas — pour libérer complètement leur espace de page. Sans ça, le
       reste de la page (thème, contenu du module, etc.) reste invisible
       mais occupe quand même toute sa hauteur normale, ce qui rend le
       document artificiellement très long sur plusieurs pages. Or un
       élément position:fixed est répété par Chrome sur CHAQUE page qui en
       résulte — c'est ce qui causait la fiche dupliquée et tronquée à
       partir de la 2e page.
       @since 3.4.11 - @author Christian Pelletier
       CORRECTIF @since 3.4.17 : ces deux règles s'appliquaient à TOUTE
       impression sur TOUTE page du site, même quand #sp-ui-impression
       n'existe pas (donc pour l'impression de n'importe quel autre module,
       comme le calendrier). Elles cachaient alors la page entière — page
       blanche à l'impression, partout sur le site. Une première tentative
       a limité ces règles à ":has(#sp-ui-impression)", mais ce sélecteur
       n'est pas toujours évalué de façon fiable par le moteur d'impression
       de Chrome — ce qui a cette fois causé une page blanche pour la fiche
       membre ELLE-MÊME.
       CORRECTIF @since 3.4.18 : remplacé par une classe posée directement
       sur <body> par window.spImprimerFiche() juste avant window.print()
       (voir sp-ui/index.php). Sans ambiguïté, contrairement à :has().
       - @author Christian Pelletier */
    body.sp-ui-impression-actif > *:not(#sp-ui-impression) {
        display: none !important;
    }

    /* Ceinture de sécurité pour tout ce qui ne serait pas un enfant direct
       de <body> (ex. contenu injecté plus profondément par un thème ou un
       plugin). Même correctif @since 3.4.18 : classe body plutôt que :has(). */
    body.sp-ui-impression-actif * {
        visibility: hidden !important;
    }

    #wpadminbar {
        display: none !important;
    }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
    }

    #sp-ui-impression,
    #sp-ui-impression * {
        visibility: visible !important;
    }

    #sp-ui-impression {
        display: block !important;
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        /* PAS de position:fixed/absolute ici. Un élément position:fixed
           est réimprimé EN ENTIER sur CHAQUE page dès que le contenu total
           dépasse une page — pas seulement s'il continue, il recommence du
           début à chaque fois. C'est ce qui causait la fiche dupliquée
           (page 1 complète, puis reprise tronquée en page 2) pour tout
           membre dont la fiche dépasse une page. Comme tous les autres
           enfants de <body> sont à display:none ci-dessus, la fiche est
           déjà seule dans le document en flux normal — elle s'écoule donc
           correctement sur autant de pages que nécessaire.
           @since 3.4.12 - @author Christian Pelletier */
    }

    .sp-impression__fiche {
        border: 1px solid #ccc;
        /* Certains outils d'extraction de texte PDF perdent des lettres
           fusionnées en ligature (ex. « fi » → glyphe unique), ce qui
           donne « Planication » au lieu de « Planification » dans le
           texte copié/recherché d'un PDF archivé — même si l'impression
           visuelle est correcte. Désactivé par précaution.
           @since 3.4.11 - @author Christian Pelletier */
        font-variant-ligatures: none;
    }

    .sp-impression__fiche tr {
        page-break-inside: avoid;
    }

    body {
        font-size: 12px;
    }
}
