@media (min-width: 992px) {
    .modal-xlg {
        --tblr-modal-width: 1080px;
    }
}
.btn-filter {
    background-color: var(--tblr-bg-surface-secondary);
    padding: 10px;
}

.btn-filter > i {
    font-size: 0.7em;
    color: #A1A0A0FF;
}

.btn-filter.dropdown-toggle::after {
    color: #A5A4A4FF;
}

.structure-meta {
    font-size: 0.8em;
    color: grey;
}

.card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

button.action-plus {
    height: 100%;
    width: 40px;
}

div.alert p:last-child {
    margin-bottom: 0;
}

table.dataTable tbody tr > .dtfc-fixed-start, table.dataTable tbody tr > .dtfc-fixed-end, table.dataTable thead tr > .dtfc-fixed-start, table.dataTable thead tr > .dtfc-fixed-end {
    background-color: white;
}

/* Affichage des étapes cassé sur l'espace adhérent */
.adhesions-list .steps {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    border-left: 0;
    margin-left: 0;
    padding-left: 0;
    margin-bottom: 1rem;
}
.adhesions-list .steps .step-item {
    flex: 1 1 0;
}

/* Empêche l'inversion du logo en dark mode */
.navbar-brand-image {
    filter: none !important;
}

/* Charte graphique FAS 2026 §1.3 — vert foncé pour texte/icône sur fond vert clair
   (bg-primary-lt). text-primary (#00a97a) n'offre qu'un contraste ≈2,7:1 sur ce fond,
   sous le minimum WCAG (3:1 pour icônes/graphiques, 4.5:1 pour le texte). */
:root {
    --fas-vert-fonce: #004c35;
}
.text-fas-vert-fonce {
    color: var(--fas-vert-fonce) !important;
}

/* Bouton "Voir la fiche" du popup carte (leaflet_si_popup.js) — btn-primary
   (blanc sur --tblr-primary #00a97a) ne fait que ≈3:1, sous le minimum WCAG AA
   pour du texte (4.5:1). Scoped à ce bouton précis, ne touche pas .btn-primary.
   !important sur color : le popup Leaflet impose son propre bleu de lien
   (.leaflet-popup-content a), plus spécifique qu'une classe seule. */
.btn-fas-vert-fonce {
    background-color: var(--fas-vert-fonce);
    border-color: var(--fas-vert-fonce);
    color: #fff !important;
}
.btn-fas-vert-fonce:hover,
.btn-fas-vert-fonce:focus {
    background-color: color-mix(in srgb, var(--fas-vert-fonce) 85%, black);
    border-color: color-mix(in srgb, var(--fas-vert-fonce) 85%, black);
    color: #fff !important;
}

/* Popup Leaflet de l'annuaire portail (portail_annuaire_map_controller.js) —
   même bleu de lien imposé par défaut par Leaflet (.leaflet-container a) sur
   le nom de la structure, plus spécifique qu'une classe .text-primary seule
   (cf. .btn-fas-vert-fonce ci-dessus pour le même souci sur le bouton SI). */
.annuaire-map-card a.text-primary {
    color: var(--tblr-primary) !important;
}

/******* Style tables *******/
table.table.dataTable {
    margin-bottom: inherit;
}

table.dataTable {
    border-collapse: collapse !important;
}

/* Amélioration de la présentation des contrôles DataTables (recherche, pagination, longueur) */
/* DataTables v2 utilise un conteneur .dt-container et des blocs .dt-length, .dt-search etc. */
.dt-container {
    padding: .5rem .75rem; /* ajoute un léger padding autour des contrôles */
}

/* S'assure qu'il y a de l'espace entre le bord de la carte et les contrôles */
.card .dt-container {
    padding: .75rem; /* aligne sur le padding Bootstrap par défaut des card-body */
}

/* Harmonise les champs de recherche et select avec Bootstrap */
.dt-search input[type="search"],
.dt-length select {
    margin: 0 .5rem 0 0; /* espace droite */
}

/* Quand la table n'a pas de card-body padding (ex: p-0), on injecte de l'air via le conteneur */
.card-body.p-0 > .dt-container {
    padding: .75rem .75rem 0 .75rem;
}

.blur-active *:not(.dt-button-collection):not(.dt-button-collection *) {
    filter: blur(2px);
    pointer-events: none;
    user-select: none;
}
/******* Fin Style tables *******/


/******* Style cards *******/
.card-header {
    cursor: pointer;
}
/******* Fin Style card *******/



/******* Liste bootstrap séparée  *******/
.list-group-unbordered>.list-group-item {
    border-left: 0;
    border-radius: 0;
    border-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.list-group-unbordered>.list-group-item > a {
    color: #007bff;
    text-decoration: none;
    background-color: transparent;
}

/* Supprimer la bordure du bas uniquement sur le dernier élément */
.list-group-unbordered.no-bottom-border  > .list-group-item:last-child {
    border-bottom: 0;
}
/******* Fin Liste bootstrap séparée *******/


/******************* tomselect *****************/
.ts-control {
    display: flex !important;
    align-items: center !important; /* ✅ Centrage vertical */
    padding: 0.375rem 0.75rem !important;
    min-height: 38px;
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.ts-wrapper.single .ts-control {
    background-image: none !important;
}

.ts-control::after {
    display: none !important;
}

.ts-control {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.375rem !important;
    background-color: white !important;
    padding: 0.375rem 0.75rem !important;
    min-height: 38px;
    box-shadow: none !important;
}

.ts-wrapper.single .ts-control {
    background-image : none !important;
}

/*.ts-wrapper.form-control.single,*/
/*.ts-wrapper.form-control.multi*/
/*{*/
/*    border: none !important;*/
/*    padding: 0 !important;*/
/*}*/


/* Supprimer l'icône de chevron si tu ne la veux pas */
.ts-control::after {
    display: none !important;
}

/* Supprime le fond gris au survol ou quand pas focus */
.ts-wrapper.single:hover .ts-control,
.ts-wrapper.single:not(.focus) .ts-control {
    background-color: white !important;
}

.ts-wrapper.single {
    /*background-color: transparent !important;*/
    box-shadow: none !important;
}

.ts-wrapper.form-control {
    padding-left: 0;
}

.ts-wrapper.form-control.tomselect.multi {
    padding-left: 0;
}
/****** Style en mode dark */
/* Appliquer uniquement en mode sombre */
[data-bs-theme="dark"] .ts-control {
    background-color: #111827 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
}

[data-bs-theme="dark"] .ts-control input {
    background-color: transparent !important;
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .ts-dropdown {
    background-color: #111827 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
}

[data-bs-theme="dark"] .ts-dropdown .option {
    background-color: #111827 !important;
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .ts-dropdown .option.active,
[data-bs-theme="dark"] .ts-dropdown .option:hover {
    background-color: #374151 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .ts-wrapper.single.input-active .ts-control {
    background-color: #1f2937 !important;
}

[data-bs-theme="dark"] .ts-wrapper.multi .ts-control > div {
    background-color: #1f2937 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
}

[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button .item .remove {
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .ts-control input {
    background-color: transparent !important; /* ou #111827 si tu veux du plein */
    color: #e5e7eb !important;
    border: none !important;
}

[data-bs-theme="dark"] .ts-control::after {
    border-color: #e5e7eb !important; /* la flèche de sélection */
}

[data-bs-theme="dark"] .ts-wrapper.single .ts-control {
    background-color: #111827 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
}

[data-bs-theme="dark"] .ts-control input::placeholder {
    color: #9ca3af !important; /* gris clair */
}


/******************* fin tomselect *****************/

/* Dashboards - lisibilite en mode sombre */
:root.theme-dark .dash-col .card-header,
:root.theme-dark .cw-col .card-header,
:root.theme-dark #customWidgetsZone .card-header,
body.theme-dark .dash-col .card-header,
body.theme-dark .cw-col .card-header,
body.theme-dark #customWidgetsZone .card-header,
[data-bs-theme="dark"] .dash-col .card-header,
[data-bs-theme="dark"] .cw-col .card-header,
[data-bs-theme="dark"] #customWidgetsZone .card-header,
body[data-bs-theme="dark"] .dash-col .card-header,
body[data-bs-theme="dark"] .cw-col .card-header,
body[data-bs-theme="dark"] #customWidgetsZone .card-header {
    background-color: #111827 !important;
    border-bottom-color: #1f2937 !important;
    color: #f9fafb !important;
}
:root.theme-dark .dash-col .card-title,
:root.theme-dark .dash-col .card-header .h5,
:root.theme-dark .cw-col .card-title,
:root.theme-dark .cw-col .card-header .h5,
body.theme-dark .dash-col .card-title,
body.theme-dark .dash-col .card-header .h5,
body.theme-dark .cw-col .card-title,
body.theme-dark .cw-col .card-header .h5,
[data-bs-theme="dark"] .dash-col .card-title,
[data-bs-theme="dark"] .dash-col .card-header .h5,
[data-bs-theme="dark"] .cw-col .card-title,
[data-bs-theme="dark"] .cw-col .card-header .h5,
body[data-bs-theme="dark"] .dash-col .card-title,
body[data-bs-theme="dark"] .dash-col .card-header .h5,
body[data-bs-theme="dark"] .cw-col .card-title,
body[data-bs-theme="dark"] .cw-col .card-header .h5 {
    color: #f9fafb !important;
}
:root.theme-dark .dash-col .card-header small,
:root.theme-dark .cw-col .card-header small,
body.theme-dark .dash-col .card-header small,
body.theme-dark .cw-col .card-header small,
[data-bs-theme="dark"] .dash-col .card-header small,
[data-bs-theme="dark"] .cw-col .card-header small,
body[data-bs-theme="dark"] .dash-col .card-header small,
body[data-bs-theme="dark"] .cw-col .card-header small {
    color: #cbd5e1 !important;
}
:root.theme-dark .dash-col .text-muted,
body.theme-dark .dash-col .text-muted,
[data-bs-theme="dark"] .dash-col .text-muted,
body[data-bs-theme="dark"] .dash-col .text-muted {
    color: #cbd5e1 !important;
}
:root.theme-dark .dash-col .table,
body.theme-dark .dash-col .table,
[data-bs-theme="dark"] .dash-col .table,
body[data-bs-theme="dark"] .dash-col .table {
    color: #e5e7eb;
}
:root.theme-dark .dash-col .table thead th,
body.theme-dark .dash-col .table thead th,
[data-bs-theme="dark"] .dash-col .table thead th,
body[data-bs-theme="dark"] .dash-col .table thead th {
    color: #f3f4f6;
}


/******************* datePicker *****************/
/* Espacement des jours du calendrier */
.datepicker table tr td {
    padding: 8px !important;
}

.datepicker table tr th {
    padding: 8px !important;
}

/* Plus d'espace pour les boutons de jours */
.datepicker table tr td.day {
    padding: 10px !important;
}
/******************* fin datePicker *****************/


/******************* custom elements *****************/
@media (min-width: 970px) {
    .col-md-2_5 {
        flex: 0 0 auto;
        width: 20.833333%; /* (2.5 / 12) * 100 */
    }
}
/******************* custom elements *****************/

/******************* Style alertes *****************/
.alert {
    display: flex;
    align-items: flex-start; /* icône en haut */
    gap: .5rem;
}

.alert .alert-text {
    flex: 1;          /* occupe la largeur dispo */
    white-space: normal; /* autorise les retours */
}
/******************* Fin Style alertes *****************/

/******************* Style frise *****************/
/* Scope Tabler steps to horizontal in adhesion list view to avoid v1.2 vertical override */
.adhesions-list .steps {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    border-left: 0;
    margin-left: 0;
    padding-left: 0;
    margin-bottom: 1rem;
}
.adhesions-list .steps .step-item {
    flex: 1 1 0;
}
a.disabled-link {
    color: inherit;          /* hérite de la couleur du texte parent */
    text-decoration: none;   /* retire le souligné */
    cursor: default;         /* curseur normal au lieu de pointer */
    pointer-events: none;    /* empêche le clic */
}
/******************* Fin Style frise *****************/

/******************* Style pickup (exemple step : membres CA du process adhésion *****************/
.toggle-card-radios {
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    border-radius: 1rem;
    padding: 0;
    transition: transform .08s ease, box-shadow .2s ease, border-color .2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.toggle-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.toggle-card.selected { border-color: var(--bs-primary); box-shadow: 0 0 0 3px rgba(13,110,253,.15); }
.toggle-card:focus { outline: none; }

.toggle-card .toggle-card-body { padding: 16px 18px; text-align: left; }
.toggle-icon { font-size: 24px; margin-right: 10px; vertical-align: middle; }
.toggle-title { font-weight: 600; font-size: 16px; }
.toggle-desc { font-size: 12px; color: #6c757d; }

@media (min-width: 576px) {
    .toggle-card .toggle-card-body { display: flex; align-items: center; }
}
/******************* Fin Style pickup (exemple step : membres CA du process adhésion *****************/
/******************* Style alert collapse *****************/
.alert-help.collapsed .help-content { display: none !important; }
.alert-help .chevron { transition: transform .2s !important; }
.alert-help.collapsed .chevron { transform: rotate(180deg) !important; }
/******************* fin Style alert collapse *****************/

/******************* Champ file : Mettre le champ de téléversement en surbrillance lors du survol en drag and drop. *****************/
.file-drop.is-dragover {
    border: 2px dashed #0d6efd;
    background: #eef5ff;
}
/******************* Fin Champ file *****************/






/* Ensure each form error message appears on its own line */
.invalid-feedback .form-error-message,
.invalid-feedback.d-block .form-error-message {
    display: block;
}

/******************* Styles Groupes modernes *****************/
/* En-tête avec gradient */
.groupe-header-gradient {
    background: linear-gradient(135deg, var(--tblr-primary) 0%, #264653 100%);
    color: white;
}

/* Quick actions grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--tblr-border-color);
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, var(--tblr-primary) 0%, #264653 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--tblr-primary-rgb), 0.3);
    text-decoration: none;
}

/* Liste des membres moderne */
.membre-list-item {
    transition: all 0.2s ease;
    border-radius: 4px;
}

.membre-list-item:hover {
    background-color: rgba(var(--tblr-primary-rgb), 0.05);
}

/* Dark mode pour les styles groupes */
[data-bs-theme="dark"] .quick-action-btn {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .quick-action-btn:hover {
    background: linear-gradient(135deg, var(--tblr-primary) 0%, #264653 100%);
    color: white;
}

[data-bs-theme="dark"] .membre-list-item:hover {
    background-color: rgba(var(--tblr-primary-rgb), 0.1);
}
/******************* Fin Styles Groupes modernes *****************/

.notification-badge-count {
    top: 0.15rem !important;
    right: 0.15rem !important;
    transform: translate(-35%, 15%);
}

.form-input.prefilled, .form-control.prefilled, .ts-control.prefilled {
    border-color: #c8e6c9 !important;
    background-color: #f1f8e9 !important;
}

.form-help.success {
    font-size: 12px;
    color: #2e7d32;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left !important;
    background-color: transparent !important;
    justify-content: flex-start !important;
}

/******************* Styles Fiche Adhésion (Design Mockup) *****************/
.result-box {
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.result-label {
    font-weight: 600;
    font-size: 1.1rem;
}

.result-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0080ff;
}

.grille-info {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.grille-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.grille-table td {
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.grille-table tr:last-child td {
    border-bottom: 0;
}

.grille-table tr.selected {
    background-color: #e8f4ff;
    font-weight: 600;
}

.grille-table tr.selected td {
    color: #0066cc;
    border-bottom-color: #d0e7ff;
    padding-left: 8px;
    padding-right: 8px;
}

.recap-total {
    background-color: #1e40af;
    color: white;
    padding: 2rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}

.recap-total-label {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.recap-total-amount {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.recap-total-formula {
    font-size: 0.95rem;
    opacity: 0.8;
}

.recap-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    height: 100%;
}

.recap-card-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
}

.recap-card-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.recap-card-detail {
    font-size: 0.8rem;
    color: #94a3b8;
}

.override-section {
    background-color: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 12px;
    padding: 1.5rem;
}

.override-title {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 1rem;
}

.etab-toolbar {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.meta-label {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
}

.meta-value {
    font-weight: 600;
    color: #1e293b;
}

.section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.section-icon.blue { background-color: #e8f4ff; }
.section-icon.green { background-color: #f0fdf4; }
.section-icon.orange { background-color: #fff7ed; }

.amount-badge {
    font-size: 1.25rem;
    font-weight: 700;
}

/******************* Fin Styles Fiche Adhésion *****************/

.container-narrow {
    max-width: 70% !important;
    width: 70% !important;
}

/* =====================================================================
 * Bouton de recherche dans l'en-tête (.nav-search-trigger)
 * Pseudo-input plein-grand, en pill, qui ouvre la modale globale.
 * ===================================================================== */
.nav-search-wrapper {
    flex: 1 1 auto;
    max-width: 560px;
    min-width: 0;
}
/* Ticket 1025 : centré dans la barre elle-même, et non dans l'espace libre
   entre le logo et le groupe de droite (plus large, il décalait le champ de
   130 px vers la gauche à 1 440 px). Sous 1 200 px la place manque : le champ
   reste dans le flux, centré dans l'espace libre (mx-auto). */
@media (min-width: 1200px) {
    header.navbar > .container-xl {
        position: relative;
    }
    .nav-search-wrapper {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        /* Largeur explicite : hors flux, le champ se réduirait à son contenu, et
           changerait de largeur d'une page à l'autre (lien sur /recherche).
           À 1 200 px, laisse 360 px au logo et au badge d'en-tête. */
        width: min(560px, 40vw);
    }
}
.nav-search-trigger {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: 42px;
    width: 100%;
    min-width: 320px;
    padding: 0 .9rem 0 1rem;
    border: 1px solid var(--tblr-border-color);
    border-radius: 999px;
    background: var(--tblr-bg-surface-secondary, rgba(0, 0, 0, .02));
    color: var(--tblr-secondary);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.nav-search-trigger:hover,
.nav-search-trigger:focus,
.nav-search-trigger:focus-visible {
    background: var(--tblr-card-bg, #fff);
    border-color: var(--tblr-primary, #206bc4);
    box-shadow: 0 0 0 4px rgba(var(--tblr-primary-rgb, 32, 107, 196), .08);
    color: var(--tblr-secondary);
    outline: none;
    text-decoration: none;
}
.nav-search-trigger__icon {
    font-size: 1rem;
    color: var(--tblr-secondary);
    flex-shrink: 0;
}
.nav-search-trigger:hover .nav-search-trigger__icon,
.nav-search-trigger:focus .nav-search-trigger__icon {
    color: var(--tblr-primary, #206bc4);
}
.nav-search-trigger__placeholder {
    flex: 1 1 auto;
    text-align: left;
    font-size: .9rem;
    color: var(--tblr-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
/* Vrai input qui remplace le placeholder visuel — permet de saisir directement
   dans la barre d'en-tête (la valeur sera transférée à la modale à l'ouverture). */
.nav-search-trigger__input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: .9rem;
    color: var(--tblr-body-color);
    font-weight: 500;
    padding: 0;
    line-height: 1;
}
.nav-search-trigger__input::placeholder {
    color: var(--tblr-secondary);
    font-weight: 500;
    opacity: 1;
}
.nav-search-trigger__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}
/* Quand l'input a le focus, on garde le visuel "actif" du conteneur */
.nav-search-trigger:focus-within {
    background: var(--tblr-card-bg, #fff);
    border-color: var(--tblr-primary, #206bc4);
    box-shadow: 0 0 0 4px rgba(var(--tblr-primary-rgb, 32, 107, 196), .08);
}
.nav-search-trigger:focus-within .nav-search-trigger__icon {
    color: var(--tblr-primary, #206bc4);
}
.nav-search-trigger__kbd {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.nav-search-trigger__kbd kbd {
    background: var(--tblr-card-bg, #fff);
    border: 1px solid var(--tblr-border-color);
    color: var(--tblr-secondary);
    font-size: .7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.2;
}

/* Plus large sur grands écrans pour mieux occuper la navbar */
@media (min-width: 1200px) {
    .nav-search-trigger { min-width: 380px; }
}
@media (min-width: 1400px) {
    .nav-search-trigger { min-width: 460px; }
}
@media (min-width: 1600px) {
    .nav-search-trigger { min-width: 540px; }
}

/* Dark mode */
[data-bs-theme="dark"] .nav-search-trigger {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .1);
}
[data-bs-theme="dark"] .nav-search-trigger:hover,
[data-bs-theme="dark"] .nav-search-trigger:focus {
    background: rgba(255, 255, 255, .08);
    border-color: var(--tblr-primary, #206bc4);
}
[data-bs-theme="dark"] .nav-search-trigger__kbd kbd {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .6);
}

/* Compat ascendante : ancien sélecteur .nav-search-btn — neutralise
   le hover sombre si quelqu'un retombe dessus accidentellement */
.nav-search-btn:hover,
.nav-search-btn:focus,
.nav-search-btn:active {
    background-color: var(--tblr-bg-surface-secondary) !important;
    border-color: var(--tblr-border-color) !important;
    color: var(--tblr-secondary) !important;
}
.nav-search-btn:hover i,
.nav-search-btn:hover span,
.nav-search-btn:focus i,
.nav-search-btn:focus span {
    color: var(--tblr-secondary) !important;
}

/* ============================================================
 * Recherche globale — vue cartes
 * ============================================================ */

.gs-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.gs-hit-card {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 320px;        /* basis 320px → cap à 4 cartes/rangée sur Full HD,
                               tout en restant lisible sur des écrans plus étroits */
    max-width: 100%;        /* prevent overflow on narrow viewports */
    text-decoration: none;
    color: inherit;
    background: var(--tblr-card-bg, #fff);
    border: 1px solid var(--tblr-border-color);
    border-radius: .5rem;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    min-height: 7.5rem;
}

/* Les cartes portent aussi .global-search-hit (navigation clavier) : sa bordure
   gauche de 3 px transparente — l'accent de la vue liste — effaçait la bordure
   gauche des cartes non survolées (ticket 1025). Placée avant les règles de
   survol pour qu'elles gardent la main. */
.gs-hit-card.global-search-hit {
    border-left: 1px solid var(--tblr-border-color);
}

.gs-hit-card:hover,
.gs-hit-card:focus,
.gs-hit-card.active {
    transform: translateY(-2px);
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08);
    text-decoration: none;
    color: inherit;
}

.gs-hit-card__stripe {
    height: 3px;
    width: 100%;
    flex-shrink: 0;
}

.gs-hit-card__inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: .75rem .9rem;
    gap: .35rem;
}

.gs-hit-card__title {
    font-size: .9375rem;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.gs-hit-card__subtitle {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: .15rem;
}

/* Coloured border accent on hover, matching the section colour.
   Variants generated for each Tabler theme colour used in SEARCH_ENTITIES. */
.gs-hit-card-blue:hover,    .gs-hit-card-blue:focus    { border-color: var(--tblr-blue,    #206bc4); }
.gs-hit-card-teal:hover,    .gs-hit-card-teal:focus    { border-color: var(--tblr-teal,    #0ca678); }
.gs-hit-card-green:hover,   .gs-hit-card-green:focus   { border-color: var(--tblr-green,   #2fb344); }
.gs-hit-card-purple:hover,  .gs-hit-card-purple:focus  { border-color: var(--tblr-purple,  #ae3ec9); }
.gs-hit-card-orange:hover,  .gs-hit-card-orange:focus  { border-color: var(--tblr-orange,  #f76707); }
.gs-hit-card-cyan:hover,    .gs-hit-card-cyan:focus    { border-color: var(--tblr-cyan,    #17a2b8); }
.gs-hit-card-pink:hover,    .gs-hit-card-pink:focus    { border-color: var(--tblr-pink,    #d6336c); }
.gs-hit-card-lime:hover,    .gs-hit-card-lime:focus    { border-color: var(--tblr-lime,    #74b816); }

/* Compact density on narrow viewports */
@media (max-width: 575.98px) {
    .gs-cards-grid {
        gap: .5rem;
    }
    .gs-hit-card {
        flex: 1 1 100%;       /* single column on mobile */
    }
}

/* ============================================================
 * Recherche globale — view switcher (Liste / Cartes)
 * ============================================================ */

.gs-view-switcher .btn {
    border-radius: .375rem;
}
.gs-view-switcher .btn + .btn {
    margin-left: -1px;
}
.gs-view-switcher .btn:not(.btn-primary):hover {
    background-color: var(--tblr-bg-surface-secondary);
    color: var(--tblr-secondary);
    border-color: var(--tblr-border-color);
}

/* Switcher Liste/Cartes intégré dans la barre de recherche */
.gs-search-bar-divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--tblr-border-color);
    margin: 0 .25rem;
}
.gs-search-bar-switcher {
    display: inline-flex;
    flex-shrink: 0;
}
.gs-search-bar-switcher:empty {
    display: none;
}
.gs-search-bar-switcher .gs-view-switcher .btn {
    padding: .35rem .55rem;
    font-size: .8125rem;
    line-height: 1;
}

/* Bandeau de filtres contextuels dans la barre d'en-tête (single-type mode) */
.gs-global-filters {
    width: 100%;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--tblr-border-color);
}
.gs-global-filters .gs-inline-filters {
    margin: 0;
}
.gs-global-filters .gs-filter-field {
    min-width: 10rem;
    flex: 0 1 auto;
}
.gs-global-filters .gs-filter-field .ts-wrapper,
.gs-global-filters .gs-filter-field select {
    min-width: 10rem;
}

/* Filtres contextuels alignés à droite dans le card-header (à gauche du badge compteur) */
.gs-section-filters-inline .gs-inline-filters {
    margin: 0;
}
.gs-section-filters-inline .gs-filter-field {
    width: 9rem;
    min-width: 9rem;
    max-width: 9rem;
    flex: 0 0 9rem;
}
.gs-section-filters-inline .gs-filter-field .form-label {
    margin-bottom: .2rem !important;
}
.gs-section-filters-inline .gs-filter-field .ts-wrapper,
.gs-section-filters-inline .gs-filter-field select {
    width: 100%;
    max-width: 100%;
}

/* Vignette Contact : layout dédié (Prenom NOM / Fonction / Mail / Téléphone) */
.gs-hit-card-contact .gs-hit-card__title {
    font-size: .95rem;
}
.gs-hit-card-contact .gs-hit-card__subtitle {
    font-style: italic;
}
.gs-hit-card-contact .gs-contact-lines {
    margin-top: .5rem;
}
.gs-hit-card-contact .gs-contact-lines .text-truncate {
    max-width: 100%;
    overflow: hidden;
}

/* ========================================================================
 * Recherche globale — composant /recherche + modale (déplacé de
 * templates/global_search/index.html.twig pour pouvoir styler la modale
 * inclue dans base.html.twig).
 * ======================================================================== */

/* Search bar */
.gs-search-bar {
    border: 1px solid var(--tblr-border-color);
    border-radius: .75rem;
    transition: box-shadow .2s, border-color .2s;
}
.gs-search-bar:focus-within {
    border-color: var(--tblr-primary);
    box-shadow: 0 0 0 .25rem rgba(var(--tblr-primary-rgb, 32,107,196), .1);
}
.gs-search-bar .form-control {
    font-weight: 500;
}
.gs-search-bar .form-control::placeholder {
    color: var(--tblr-secondary);
    font-weight: 400;
}
.gs-search-bar .shortcut-badge kbd {
    background: var(--tblr-bg-surface-secondary, #f0f0f0);
    border: 1px solid var(--tblr-border-color);
    color: var(--tblr-secondary);
    font-size: .7rem;
    padding: .1rem .4rem;
    border-radius: .25rem;
    font-family: inherit;
    font-weight: 600;
}

/* Two-column layout */
.gs-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}
.gs-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
}
.gs-main {
    flex: 1;
    min-width: 0;
}

/* Facet cards */
.gs-facet-card {
    border-radius: .75rem;
    overflow: visible;
}
.gs-facet-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--tblr-border-color);
}
.gs-facet-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--tblr-secondary);
    margin: 0;
}

.gs-facet-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem 0;
    border-bottom: 1px solid var(--tblr-border-color-translucent, rgba(0,0,0,.04));
}
.gs-facet-item:last-child {
    border-bottom: none;
}
.gs-facet-item label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-size: .85rem;
    line-height: 1.3;
    user-select: none;
}
.gs-facet-count {
    font-size: .75rem;
    color: var(--tblr-secondary);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    white-space: nowrap;
}
.gs-facet-item.disabled {
    opacity: .4;
    pointer-events: none;
}
.gs-facet-item .form-check-input {
    margin: 0;
    flex-shrink: 0;
}

/* Active filter pills */
.gs-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    margin-bottom: .75rem;
}
.gs-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .625rem;
    border-radius: 2rem;
    font-size: .78rem;
    font-weight: 500;
    background: rgba(var(--tblr-primary-rgb, 32,107,196), .08);
    color: var(--tblr-primary);
    border: 1px solid rgba(var(--tblr-primary-rgb, 32,107,196), .15);
    transition: background .15s, border-color .15s;
    cursor: pointer;
    text-decoration: none;
}
.gs-filter-pill:hover {
    background: rgba(var(--tblr-primary-rgb, 32,107,196), .15);
    border-color: rgba(var(--tblr-primary-rgb, 32,107,196), .25);
    color: var(--tblr-primary);
}
.gs-filter-pill .btn-close {
    font-size: .5rem;
    margin-left: .15rem;
    opacity: .6;
}

/* Result sections */
.gs-result-section {
    border-radius: .75rem !important;
    overflow: hidden;
    border: 1px solid var(--tblr-border-color);
}
.gs-result-section .card-header {
    background: transparent;
}

.gs-hit {
    border-left: 3px solid transparent;
    transition: border-color .15s, background .15s;
}
.gs-hit:hover,
.gs-hit.active {
    background: rgba(var(--tblr-primary-rgb, 32,107,196), .04);
    border-left-color: var(--tblr-primary);
}
.gs-hit .text-truncate {
    max-width: 100%;
}

.global-search-section { overflow: hidden; border-radius: .75rem !important; }
.global-search-section .card-header { background: transparent; }
.global-search-hit {
    border-left: 3px solid transparent;
    transition: border-color .15s, background .15s;
}
.global-search-hit:hover,
.global-search-hit.active {
    background: rgba(var(--tblr-primary-rgb, 32,107,196), .04);
}
/* Accent gauche réservé aux lignes de la vue liste : sur une carte survolée, il
   colorait le seul côté gauche d'une autre couleur que la section (ticket 1025). */
.global-search-hit:not(.gs-hit-card):hover,
.global-search-hit:not(.gs-hit-card).active {
    border-left-color: var(--tblr-primary);
}
.global-search-hit .text-truncate { max-width: 100%; }

/* Total count bar */
.gs-total-count {
    font-size: .85rem;
    color: var(--tblr-secondary);
    font-weight: 500;
}
.gs-total-count strong {
    color: var(--tblr-body-color);
}

/* Spinner */
.gs-spinner .spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: .2em;
}

/* Empty / idle states */
.gs-main .empty {
    padding: 3rem 1rem;
}
.gs-main .empty-icon {
    margin-bottom: .5rem;
}

/* Region select refinement */
.gs-sidebar .form-select {
    font-size: .85rem;
}

/* Clear filters link */
.gs-clear-link {
    font-size: .75rem;
    color: var(--tblr-danger);
    text-decoration: none;
    transition: color .15s;
}
.gs-clear-link:hover {
    color: var(--tblr-danger);
    text-decoration: underline;
}

/* Inline section filters */
.gs-section-filters {
    width: 100%;
    padding: .5rem .75rem;
    background: var(--tblr-bg-surface-secondary, rgba(0,0,0,.015));
}
.gs-section-filters .gs-filter-field {
    min-width: 11rem;
    flex: 0 1 auto;
}
.gs-section-filters .gs-filter-field .ts-wrapper,
.gs-section-filters .gs-filter-field select {
    min-width: 11rem;
}
.gs-inline-filters .form-label {
    font-size: .68rem !important;
    font-weight: 600 !important;
    color: var(--tblr-secondary) !important;
    margin-bottom: .1rem !important;
    line-height: 1 !important;
    display: block !important;
}
.gs-inline-filters .ts-wrapper {
    font-size: .78rem;
}
/* TomSelect plus compact dans les filtres contextuels.
   Sélecteur spécifique .gs-inline-filters .ts-wrapper .ts-control (0,3,0)
   pour battre tom-select-tabler.css qui a .ts-wrapper .ts-control (0,2,0)
   chargé après app.css avec un min-height calc(~42px) !important. */
.gs-inline-filters .ts-wrapper .ts-control {
    min-height: 26px !important;
    padding: 2px 8px !important;
    border-radius: .3rem !important;
    line-height: 1.1 !important;
    box-shadow: none !important;
}
.gs-inline-filters .ts-wrapper.focus .ts-control {
    box-shadow: 0 0 0 .15rem rgba(var(--tblr-primary-rgb, 32, 107, 196), .12) !important;
}
.gs-inline-filters .ts-dropdown {
    font-size: .78rem;
}
/* Items du multi-select : spécificité (0,4,1) pour battre tabler (0,3,1) */
.gs-inline-filters .ts-wrapper.multi .ts-control > div {
    font-size: .72rem !important;
    padding: 0 .35rem !important;
    margin: 1px !important;
    line-height: 1.5 !important;
    border-radius: 3px !important;
}
.gs-inline-filters .ts-wrapper.multi .ts-control > div .remove {
    margin-left: 3px !important;
    padding: 0 2px !important;
    font-size: .7rem !important;
}
.gs-inline-filters .ts-wrapper input {
    font-size: .78rem !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
}
.gs-inline-filters .form-select-sm {
    font-size: .78rem;
    padding: 2px 1.5rem 2px .4rem;
    min-height: 26px;
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 991.98px) {
    .gs-section-filters .gs-filter-field {
        min-width: 9rem;
    }
}
@media (max-width: 767.98px) {
    .gs-layout {
        flex-direction: column;
    }
    .gs-sidebar {
        width: 100%;
        position: static;
        display: flex;
        gap: .75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: .25rem;
    }
    .gs-sidebar > .card {
        min-width: 240px;
        flex-shrink: 0;
    }
    .gs-sidebar::-webkit-scrollbar {
        height: 4px;
    }
    .gs-sidebar::-webkit-scrollbar-thumb {
        background: var(--tblr-border-color);
        border-radius: 2px;
    }
}

/* Dark mode */
[data-bs-theme="dark"] .gs-search-bar {
    background: var(--tblr-bg-surface);
    border-color: var(--tblr-border-color);
}
[data-bs-theme="dark"] .gs-search-bar:focus-within {
    border-color: var(--tblr-primary);
    box-shadow: 0 0 0 .25rem rgba(var(--tblr-primary-rgb, 32,107,196), .15);
}
[data-bs-theme="dark"] .gs-search-bar .shortcut-badge kbd {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.1);
    color: rgba(255,255,255,.5);
}
[data-bs-theme="dark"] .gs-filter-pill {
    background: rgba(var(--tblr-primary-rgb, 32,107,196), .12);
    border-color: rgba(var(--tblr-primary-rgb, 32,107,196), .2);
}
[data-bs-theme="dark"] .gs-hit:hover,
[data-bs-theme="dark"] .gs-hit.active,
[data-bs-theme="dark"] .global-search-hit:hover,
[data-bs-theme="dark"] .global-search-hit.active {
    background: rgba(255,255,255,.04);
}
[data-bs-theme="dark"] .gs-facet-item {
    border-bottom-color: rgba(255,255,255,.06);
}

/* Modale globale de recherche */
#globalSearchModal .modal-dialog {
    margin-top: 3rem;
    max-width: 1320px;  /* plus large que modal-xl (1140px) pour mieux exploiter Full HD */
    width: calc(100vw - 4rem);
}
@media (min-width: 1600px) {
    #globalSearchModal .modal-dialog {
        max-width: 1500px;
    }
}
#globalSearchModal .modal-content {
    border-radius: 1rem;
    border: 1px solid var(--tblr-border-color);
}
/* Neutralise totalement les margins/padding par défaut de Bootstrap sur
   .btn-close dans la modale de recherche : sans ça les margins négatifs
   font déborder la croix par-dessus le bouton "Plein écran" voisin.
   !important nécessaire pour battre la règle Bootstrap dont la spécificité
   peut être boostée par les CSS variables. */
#globalSearchModal .modal-header .btn-close {
    margin: 0 !important;
    padding: .5rem !important;
    flex-shrink: 0;
}
#globalSearchModal .modal-header .modal-header-actions {
    flex-shrink: 0;
}
#globalSearchModal .modal-body {
    padding: 1.25rem;
    /* Fond gris (comme la page /recherche) pour que les card-sections
       blanches Adhérents/Établissements/Contacts/... ressortent visuellement. */
    background: var(--tblr-body-bg, #f6f7f9);
    /* Recouvre le bas du modal-content arrondi sans dépasser */
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}
[data-bs-theme="dark"] #globalSearchModal .modal-body {
    background: rgba(255, 255, 255, .03);
}
#globalSearchModal .gs-sidebar {
    position: static; /* dans la modale, on n'a pas besoin de sticky */
    top: auto;
}

/* Toggle global "Filtres" : masque la sidebar gauche (Région/Département/Type)
   ET les filtres contextuels dans le card-header de chaque section. */
.gs-layout.gs-filters-hidden > .gs-sidebar {
    display: none;
}
.gs-layout.gs-filters-hidden > .gs-main {
    width: 100%;
}
.gs-layout.gs-filters-hidden .gs-section-filters-inline {
    display: none;
}
/* Bouton "Filtres" — aligné visuellement sur le switcher Liste/Cartes
   (mêmes dimensions, typo, border-radius, états hover/active). */
.gs-filters-toggle {
    padding: .35rem .55rem;
    font-size: .8125rem;
    line-height: 1;
    border-radius: .375rem;
}
.gs-filters-toggle:not(.active):hover {
    background-color: var(--tblr-bg-surface-secondary);
    color: var(--tblr-secondary);
    border-color: var(--tblr-border-color);
}
/* Look "actif" (filtres visibles) — mêmes couleurs que les boutons primary
   du switcher Liste/Cartes. */
.gs-filters-toggle.active {
    background-color: var(--tblr-primary);
    border-color: var(--tblr-primary);
    color: #fff;
}
.gs-filters-toggle.active:hover {
    background-color: var(--tblr-primary);
    border-color: var(--tblr-primary);
    color: #fff;
    filter: brightness(.95);
}
@media (max-width: 991.98px) {
    #globalSearchModal .modal-dialog {
        margin: 0;
        max-width: none;
        height: 100%;
    }
    #globalSearchModal .modal-content {
        border-radius: 0;
        height: 100vh;
    }
}

/* ------------------------------------------------------------------
   Badge organizer hi.events (templates/hi_events/_partials/_organizer_badge)
   ------------------------------------------------------------------
   Le nom d'un organizer atteint facilement 45 caractères (« FAS FEDERATION DES
   ACTEURS DE LA SOLIDARITE »). Or .badge est en white-space: nowrap sans
   max-width : le badge débordait de sa colonne de datagrid (pistes figées en
   minmax(15rem, 1fr) : le contenu trop large sort de sa zone et passe par-dessus
   la colonne voisine) et monopolisait la largeur de la colonne « Organizer » des
   tableaux. On tronque donc le nom ; l'icône et l'identifiant ne se compriment
   jamais, et l'infobulle du badge porte le nom complet. */
.he-organizer-badge {
    max-width: 100%;
    justify-content: flex-start;
}
.he-organizer-badge__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.he-organizer-badge > i,
.he-organizer-badge__id {
    flex: 0 0 auto;
}
/* En tableau, la largeur d'une cellule suit son contenu : un max-width en
   pourcentage n'y borne rien (référence circulaire). Il faut une borne dure pour
   que la colonne « Organizer » cesse de manger la place des autres. */
td .he-organizer-badge {
    max-width: 12rem;
}
