/*
 * Evidio — Design system
 * Bootstrap 5 + Sneat visual layer, couleur primaire navy municipale
 * RGAA : skip-link, focus-visible, aria-* conservés dans les templates
 */

/* ─── Tokens ─────────────────────────────────────────────────────────── */
:root {
    --fl-navy:        #08245c;
    --fl-navy-dark:   #03163d;
    --fl-navy-light:  #e7edf8;
    --fl-navy-soft:   #f0f4fb;

    --fl-ok:          #23732f;
    --fl-ok-soft:     #e8f5eb;
    --fl-warning:     #9a6a16;
    --fl-warning-soft:#fff8e6;
    --fl-danger:      #c0392b;
    --fl-danger-soft: #fdf0ee;

    --fl-muted:       #5b6878;
    --fl-line:        #e4e6e8;
    --fl-surface:     #ffffff;
    --fl-bg:          #f5f5f9;

    --fl-shadow-sm:   0 0.125rem 0.375rem rgba(34, 48, 62, 0.08);
    --fl-shadow:      0 0.1875rem 0.5rem  rgba(34, 48, 62, 0.10);
    --fl-shadow-md:   0 0.25rem  0.75rem  rgba(34, 48, 62, 0.14);

    --fl-radius:      0.375rem;
    --fl-radius-lg:   0.5rem;
    --fl-font:        "Public Sans", "Segoe UI", Arial, sans-serif;
}

/* ─── Reset minimal ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--fl-bg);
    color: #384551;
    display: flex;
    flex-direction: column;
    font-family: var(--fl-font);
    /* ≥16px : public senior 75+ — jamais de corps de texte sous 1rem
       (audit 2026-07-12, constat n°14). */
    font-size: 1rem;
    line-height: 1.5;
    -webkit-tap-highlight-color: rgba(8, 36, 92, 0.12);
}

#contenu-principal {
    flex: 1 0 auto;
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Accessibilité / RGAA ───────────────────────────────────────────── */
.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9999;
    transform: translateY(-200%);
    padding: 10px 16px;
    border: 2px solid var(--fl-navy);
    border-radius: var(--fl-radius);
    background: #fff;
    color: var(--fl-navy);
    font-weight: 700;
    text-decoration: none;
    transition: transform 160ms ease;
}
.skip-link:focus-visible { transform: translateY(0); }

:focus-visible {
    outline: 2px solid var(--fl-navy);
    outline-offset: 3px;
}

/* ─── Typographie ────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: #22303e;
    font-family: var(--fl-font);
    font-weight: 600;
    line-height: 1.2;
    text-wrap: balance;
    scroll-margin-top: 88px;
}

h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h3 { font-size: 1.125rem; }

.text-muted-fl { color: var(--fl-muted) !important; }

/* ─── Liens ──────────────────────────────────────────────────────────── */
a {
    color: var(--fl-navy);
    text-underline-offset: 3px;
}
a:hover, a:focus { color: var(--fl-navy-dark); }

/* ─── Override Bootstrap primary ─────────────────────────────────────── */
.btn-primary,
.bg-primary {
    --bs-btn-bg:           var(--fl-navy);
    --bs-btn-border-color: var(--fl-navy);
    --bs-btn-hover-bg:     var(--fl-navy-dark);
    --bs-btn-hover-border-color: var(--fl-navy-dark);
    --bs-btn-active-bg:    var(--fl-navy-dark);
    background-color:      var(--fl-navy);
    border-color:          var(--fl-navy);
}
.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--fl-navy-dark);
    border-color:     var(--fl-navy-dark);
}

.btn-outline-primary {
    --bs-btn-color:        var(--fl-navy);
    --bs-btn-border-color: var(--fl-navy);
    --bs-btn-hover-bg:     var(--fl-navy);
    --bs-btn-hover-border-color: var(--fl-navy);
    color:        var(--fl-navy);
    border-color: var(--fl-navy);
}

.text-primary { color: var(--fl-navy) !important; }
.border-primary { border-color: var(--fl-navy) !important; }
.bg-label-primary {
    background: var(--fl-navy-light) !important;
    color: var(--fl-navy) !important;
}

/* ─── Layout racine ──────────────────────────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Navbar publique ─────────────────────────────────────────────────── */
.site-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid var(--fl-line);
    backdrop-filter: blur(8px);
}
.site-navbar .navbar-brand {
    color: var(--fl-navy);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.site-navbar .brand-mark {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: var(--fl-radius);
    background: var(--fl-navy);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
}
.site-navbar .nav-link {
    color: #384551;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--fl-radius);
}
.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
    background: var(--fl-navy-light);
    color: var(--fl-navy);
}

/* ─── Sidebar service (espace agent) ────────────────────────────────── */
.layout-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: 260px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--fl-line);
    box-shadow: var(--fl-shadow-sm);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    transition: transform 280ms ease;
}

.app-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--fl-line);
    min-height: 72px;
}
.app-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--fl-navy);
    font-weight: 700;
    font-size: 1.05rem;
}
.app-brand-logo {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    background: var(--fl-navy);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(8,36,92,0.22);
}
.app-brand-org {
    display: block;
    color: var(--fl-muted);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.3;
}

/* Menu interne */
.menu-inner {
    list-style: none;
    margin: 0;
    padding: 0.75rem 0;
    flex: 1;
}

.menu-header {
    padding: 0.5rem 1.25rem 0.25rem;
    color: var(--fl-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu-item { list-style: none; }

.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.625rem 1.25rem;
    margin: 2px 0.5rem;
    border-radius: var(--fl-radius);
    color: #566a7f;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
    min-height: 42px;
}
.menu-link:hover,
.menu-link:focus-visible {
    background: var(--fl-bg);
    color: var(--fl-navy);
}
/* Focus clavier net (pas seulement le fond, identique au survol) — RGAA 10.7. */
.menu-link:focus-visible {
    outline: 2px solid var(--fl-navy);
    outline-offset: -2px;
}
.menu-link[aria-current="page"],
.menu-item.active > .menu-link {
    background: var(--fl-navy-light);
    color: var(--fl-navy);
    font-weight: 600;
}

.menu-icon {
    flex-shrink: 0;
    width: 22px;
    font-size: 1.15rem;
    text-align: center;
    color: inherit;
}

/* Pied de sidebar */
.sidebar-footer {
    margin: auto 0 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--fl-line);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--fl-navy-light);
    color: var(--fl-navy);
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #384551;
    line-height: 1.2;
}
.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--fl-muted);
}

/* ─── Zone contenu service ───────────────────────────────────────────── */
.layout-page {
    flex: 1;
    min-width: 0;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

/* ─── Navbar service (top) ───────────────────────────────────────────── */
.layout-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0.75rem 1.5rem;
    background: rgba(245,245,249,0.96);
    border-bottom: 1px solid var(--fl-line);
    backdrop-filter: blur(6px);
    min-height: 64px;
}
.layout-navbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #384551;
    margin: 0;
}

/* ─── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--fl-surface);
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius-lg);
    box-shadow: var(--fl-shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--fl-line);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #384551;
}
.card-body { padding: 1.25rem; }

/* ─── Stat cards KPI (layout Sneat : icône haut-droite, chiffre bas-gauche) ── */
.stat-card {
    background: var(--fl-surface);
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius-lg);
    box-shadow: var(--fl-shadow-sm);
    padding: 1.25rem;
    display: grid;
    grid-template-areas:
        "label  icon"
        "value  icon"
        "sub    icon";
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    align-items: start;
    min-height: 110px;
    transition: box-shadow 160ms ease, transform 160ms ease;
}
.stat-card:hover {
    box-shadow: var(--fl-shadow-md);
    transform: translateY(-1px);
}
.stat-card .stat-label {
    grid-area: label;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fl-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: end;
}
.stat-card .stat-value {
    grid-area: value;
    font-size: clamp(1.6rem, 2.5vw, 2.1rem);
    font-weight: 700;
    color: var(--fl-navy);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-sub {
    grid-area: sub;
    font-size: 0.75rem;
    color: var(--fl-muted);
    font-weight: 500;
}
.stat-card .stat-icon {
    grid-area: icon;
    width: 42px;
    height: 42px;
    border-radius: var(--fl-radius);
    background: var(--fl-navy-light);
    color: var(--fl-navy);
    display: inline-grid;
    place-items: center;
    font-size: 1.2rem;
    align-self: start;
}

/* ─── Badges statut ──────────────────────────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50rem;
    /* ≥14px : les statuts sont des informations critiques (audit n°6, n°16). */
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-ok      { background: var(--fl-ok-soft);      color: var(--fl-ok); }
.badge-warning { background: var(--fl-warning-soft);  color: var(--fl-warning); }
.badge-danger  { background: var(--fl-danger-soft);   color: var(--fl-danger); }
.badge-muted   { background: #eef0f3;                 color: #566a7f; }
.badge-navy    { background: var(--fl-navy-light);    color: var(--fl-navy); }

.public-map-section {
    padding: 1rem;
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius-lg);
    background: #fff;
    box-shadow: var(--fl-shadow-sm);
}
/* Bootstrap 5.3 ne fournit pas .min-w-0. Sans elle, un enfant flex garde
   min-width:auto : un texte long (nowrap) force le débordement horizontal de
   la carte (et du bouton w-100). On rétablit l'utilitaire. */
.min-w-0 {
    min-width: 0 !important;
}

.activity-list-map {
    width: 100%;
    min-height: 280px;
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius);
    overflow: hidden;
    background: var(--fl-bg);
}
.activity-map-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: var(--fl-navy);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    transform: rotate(-45deg);
}
.activity-map-pin i {
    font-size: 18px;
    transform: rotate(45deg);
}
.activity-map-popup {
    min-width: 190px;
}
.activity-map-popup-title {
    display: block;
    margin-bottom: 4px;
    color: #22303e;
    font-weight: 700;
}
.activity-map-popup-meta {
    display: block;
    margin-top: 2px;
    color: var(--fl-muted);
    font-size: .82rem;
}
.activity-map-popup-link {
    display: inline-flex;
    margin-top: 8px;
    font-weight: 700;
    text-decoration: none;
}

.btn-outline-secondary {
    --bs-btn-color: var(--fl-muted);
    --bs-btn-border-color: var(--fl-muted);
    --bs-btn-hover-bg: var(--fl-muted);
    --bs-btn-hover-border-color: var(--fl-muted);
    --bs-btn-active-bg: var(--fl-muted);
    --bs-btn-active-border-color: var(--fl-muted);
}

/* ─── Tableaux ───────────────────────────────────────────────────────── */
.table {
    --bs-table-striped-bg: var(--fl-bg);
    --bs-table-hover-bg:   var(--fl-navy-soft);
    font-size: 0.875rem;
    margin-bottom: 0;
}
.table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fl-muted);
    border-bottom: 2px solid var(--fl-line);
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-responsive { border-radius: var(--fl-radius-lg); }

/* ─── Filtres / barre de recherche ──────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 1rem 1.25rem;
    background: var(--fl-surface);
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius-lg);
    box-shadow: var(--fl-shadow-sm);
    margin-bottom: 1.25rem;
}
.filter-bar .form-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fl-muted);
    margin-bottom: 4px;
}
.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 0.875rem;
    min-height: 38px;
}

/* ─── Formulaires ────────────────────────────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #384551;
    margin-bottom: 4px;
}
.form-control,
.form-select {
    border: 1px solid #cfd6df;
    border-radius: var(--fl-radius);
    /* ≥16px : évite aussi le zoom automatique iOS sur focus (audit n°14). */
    font-size: 1rem;
    color: #384551;
    background: #fff;
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--fl-navy);
    box-shadow: 0 0 0 3px rgba(8,36,92,0.12);
    outline: none;
}
textarea.form-control { min-height: 100px; resize: vertical; }

/* Checkbox RGAA : taille suffisante */
.form-check-input {
    width: 1.1em;
    height: 1.1em;
    margin-top: 0.2em;
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--fl-navy);
    border-color: var(--fl-navy);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(8,36,92,0.12);
}
.form-check-label { cursor: pointer; }

/* ─── Alertes / messages Django ──────────────────────────────────────── */
.alert {
    border-radius: var(--fl-radius);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--fl-ok-soft);      border-color: #b7dfbe; color: var(--fl-ok); }
.alert-warning { background: var(--fl-warning-soft); border-color: #f6d78b; color: var(--fl-warning); }
.alert-danger  { background: var(--fl-danger-soft);  border-color: #f5c0bb; color: var(--fl-danger); }
.alert-info    { background: var(--fl-navy-light);   border-color: #b8cce8; color: var(--fl-navy); }

/* ─── Page header (titre + actions) ──────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.5rem;
}
.page-header h1, .page-header h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
}
.page-header .text-muted {
    font-size: 0.875rem;
    color: var(--fl-muted);
    margin-top: 2px;
}

/* ─── État vide ──────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--fl-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--fl-line); }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* ─── Footer public ──────────────────────────────────────────────────── */
.site-footer {
    flex-shrink: 0;
    margin-top: auto;
    background: #fff;
    border-top: 1px solid var(--fl-line);
    padding: 1.25rem 0;
    font-size: 0.82rem;
    color: var(--fl-muted);
}
.site-footer a {
    color: var(--fl-muted);
    text-decoration: none;
    font-weight: 500;
}
.site-footer a:hover { color: var(--fl-navy); }

/* ─── Nav mobile public ──────────────────────────────────────────────── */
.mobile-quick-nav { display: none; }

@media (max-width: 575.98px) {
    .public-catalog-toolbar > nav,
    .public-catalog-toolbar > .btn {
        width: 100%;
    }

    .public-catalog-toolbar .nav {
        flex-wrap: nowrap;
    }

    .public-catalog-toolbar .nav-item {
        flex: 1 1 0;
    }

    .public-catalog-toolbar .nav-link {
        width: 100%;
        text-align: center;
    }
}

/* ─── Responsive sidebar ─────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .layout-menu {
        transform: translateX(-100%);
    }
    .layout-menu.is-open {
        transform: translateX(0);
    }
    .layout-page {
        margin-left: 0;
    }
    .layout-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1039;
        background: rgba(34,48,62,0.45);
    }
    .layout-overlay.is-visible {
        display: block;
    }
}

@media (max-width: 640px) {
    body { padding-bottom: 72px; }

    .content-wrapper { padding: 1rem; }

    .mobile-quick-nav {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 1030;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        background: #fff;
        border-top: 1px solid var(--fl-line);
        box-shadow: 0 -2px 8px rgba(34,48,62,0.08);
    }
    .mobile-quick-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0.5rem;
        /* Libellés de navigation lisibles au pouce (audit n°14). */
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--fl-muted);
        text-decoration: none;
        min-height: 56px;
    }
    .mobile-quick-nav a i { font-size: 1.25rem; }
    .mobile-quick-nav a:hover,
    .mobile-quick-nav a.is-active { color: var(--fl-navy); }
}

/* ─── Sneat liste d'attente numérotée ───────────────────────────────── */
.waitlist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: waitlist;
}
.waitlist-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--fl-line);
    counter-increment: waitlist;
}
.waitlist-list li:last-child { border-bottom: 0; }
.waitlist-list li::before {
    content: counter(waitlist);
    display: inline-grid;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: var(--fl-radius);
    background: var(--fl-navy-light);
    color: var(--fl-navy);
    font-weight: 700;
    font-size: 0.82rem;
}

/* ─── Sneat priority items (dashboard) ──────────────────────────────── */
.priority-item {
    display: block;
    padding: 0.875rem 1rem;
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-radius);
    background: #fff;
    color: #384551;
    text-decoration: none;
    transition: border-color 150ms, background 150ms, transform 150ms;
}
.priority-item:hover, .priority-item:focus-visible {
    border-color: #b8cce8;
    background: var(--fl-navy-soft);
    color: var(--fl-navy);
    transform: translateY(-1px);
}
.priority-item .priority-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fl-navy);
    line-height: 1;
}
.priority-item .priority-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #384551;
}
.priority-item .priority-sub {
    font-size: 0.78rem;
    color: var(--fl-muted);
}

/* ─── Nav pills override (Sneat navy, pas le bleu Bootstrap) ────────── */
.nav-pills .nav-link {
    color: var(--fl-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--fl-radius);
    padding: 0.45rem 0.9rem;
    transition: background 150ms, color 150ms;
}
.nav-pills .nav-link:hover,
.nav-pills .nav-link:focus {
    background: var(--fl-navy-light);
    color: var(--fl-navy);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background: var(--fl-navy);
    color: #fff;
}

/* ─── Tables — header plus discret ──────────────────────────────────── */
.table > :not(caption) > * > th {
    background: var(--fl-bg);
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}
.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

/* ─── Card header — poids visuel réduit ─────────────────────────────── */
.card-header {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fl-muted);
    background: transparent;
    border-bottom: 1px solid var(--fl-line);
    padding: 0.75rem 1.25rem;
}

/* ─── Bouton link agent (Voir tout) ──────────────────────────────────── */
.btn-link {
    color: var(--fl-navy);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}
.btn-link:hover { color: var(--fl-navy-dark); text-decoration: underline; }

/* ─── Focus visible global renforcé RGAA ────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--fl-navy);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ─── Scrollbar fine sur sidebar ─────────────────────────────────────── */
.layout-menu::-webkit-scrollbar { width: 4px; }
.layout-menu::-webkit-scrollbar-track { background: transparent; }
.layout-menu::-webkit-scrollbar-thumb { background: var(--fl-line); border-radius: 2px; }

/* ─── Pagination Bootstrap override (navy) ───────────────────────────── */
.pagination .page-link {
    color: var(--fl-navy);
    border-color: var(--fl-line);
    font-size: 0.875rem;
    min-width: 36px;
    text-align: center;
}
.pagination .page-link:hover,
.pagination .page-link:focus {
    background: var(--fl-navy-light);
    color: var(--fl-navy);
    border-color: var(--fl-navy-light);
}
.pagination .page-item.active .page-link {
    background: var(--fl-navy);
    border-color: var(--fl-navy);
    color: #fff;
}
.pagination .page-item.disabled .page-link {
    color: var(--fl-muted);
    border-color: var(--fl-line);
}

/* ─── Correctifs UX 2026-07 (mécanique seule, DA et palette inchangées) ── */

/* 1. Le corps de page ne défile JAMAIS horizontalement : tout contenu large
   défile dans SON conteneur (rail d'actions, table-responsive). */
.layout-page,
.content-wrapper,
.navbar-nav-right {
    min-width: 0;
}
.layout-wrapper {
    overflow-x: clip;
}

/* 2. Rail d'actions de la navbar.
   Desktop : boutons insécables qui passent à la ligne si la place manque
   (jamais de libellé cassé en deux, jamais par-dessus le titre).
   Mobile (<1200px) : les boutons défilent horizontalement dans leur propre
   rail au lieu d'élargir la page — barre masquée, geste tactile natif. */
.navbar-actions {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: .5rem;
}
.navbar-actions .btn { white-space: nowrap; }
/* Le titre de page s'efface proprement plutôt que de passer sous les boutons. */
.navbar-nav-right > p {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: .75rem;
}
@media (max-width: 1199.98px) {
    .navbar-actions {
        overflow-x: auto;
        flex-wrap: nowrap;
        /* flex-start obligatoire : avec flex-end, le début d'un rail qui
           déborde devient inatteignable au défilement (piège flexbox). */
        justify-content: flex-start;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .navbar-actions::-webkit-scrollbar { display: none; }
    .navbar-actions .btn,
    .navbar-actions form { white-space: nowrap; flex-shrink: 0; }
}

/* 3. Tableaux larges sur mobile : première colonne (le nom) épinglée pendant
   le défilement + ombres latérales qui signalent qu'on peut scroller. */
.table-responsive {
    background:
        linear-gradient(to right, var(--fl-surface) 30%, rgba(255,255,255,0)),
        linear-gradient(to left,  var(--fl-surface) 30%, rgba(255,255,255,0)) 100% 0,
        radial-gradient(farthest-side at 0 50%,   rgba(34,48,62,.18), transparent),
        radial-gradient(farthest-side at 100% 50%, rgba(34,48,62,.18), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}
@media (max-width: 767.98px) {
    .table-responsive th:first-child,
    .table-responsive td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--fl-surface);
        box-shadow: 1px 0 0 var(--fl-line);
    }
}

/* 4. En-têtes de carte : le titre ne passe jamais sous le bouton « Voir tout »
   (bouton insécable, titre tronqué proprement si la place manque). */
.card-header.d-flex {
    gap: .5rem;
}
.card-header .btn {
    white-space: nowrap;
    flex-shrink: 0;
}
.card-header h6 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
