/**
 * PilPerf Theme - Couleurs principales
 * Orange: #FF7900
 * Noir: #343640
 * Gris et blanc pour éléments secondaires
 */

:root {
    /* Couleurs principales */
    --pilperf-orange: #FF7900;
    --pilperf-black: #343640;
    
    /* Couleurs secondaires */
    --pilperf-gray-light: #f5f5f5;
    --pilperf-gray-medium: #e0e0e0;
    --pilperf-gray-dark: #757575;
    --pilperf-white: #ffffff;
    
    /* Couleurs pour les états */
    --pilperf-success: #4caf50;
    --pilperf-danger: #f44336;
    --pilperf-warning: #FF7900;
    --pilperf-info: #2196f3;
    
    /* Police globale - Roboto */
    --pilperf-font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --pilperf-font-size: 0.9375rem; /* 15px - légèrement augmenté */
}

/* Classes utilitaires pour les couleurs */
.text-pilperf-orange {
    color: var(--pilperf-orange) !important;
}

.text-pilperf-black {
    color: var(--pilperf-black) !important;
}

.bg-pilperf-orange {
    background-color: var(--pilperf-orange) !important;
}

.bg-pilperf-black {
    background-color: var(--pilperf-black) !important;
}

.border-pilperf-orange {
    border-color: var(--pilperf-orange) !important;
}

.border-pilperf-black {
    border-color: var(--pilperf-black) !important;
}

/* Boutons personnalisés */
.btn,
.btn-pilperf-orange,
.btn-pilperf-black,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.btn-pilperf-orange {
    background-color: var(--pilperf-orange);
    border-color: var(--pilperf-orange);
    color: var(--pilperf-white);
}

.btn-pilperf-orange:hover {
    background-color: #e66a00;
    border-color: #e66a00;
    color: var(--pilperf-white);
}

.btn-pilperf-black {
    background-color: var(--pilperf-black);
    border-color: var(--pilperf-black);
    color: var(--pilperf-white);
}

.btn-pilperf-black:hover {
    background-color: #2a2d35;
    border-color: #2a2d35;
    color: var(--pilperf-white);
}

/* Cards */
.card,
.card-header,
.card-body,
.card-title,
.card-text {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.card-border-orange {
    border-left: 4px solid var(--pilperf-orange) !important;
}

.card-border-black {
    border-left: 4px solid var(--pilperf-black) !important;
}

/* Liens */
a {
    color: var(--pilperf-orange);
}

a:hover {
    color: #e66a00;
}

/* Police globale pour toute la plateforme */
body, html {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
    font-weight: 600;
}

/* Titres avec tailles légèrement ajustées - Roboto */
h1, .h1 {
    font-size: 1rem !important;
}

h2, .h2 {
    font-size: 0.95rem !important;
}

h3, .h3 {
    font-size: 0.9rem !important;
}

h4, .h4, h5, .h5, h6, .h6 {
    font-size: 0.9375rem !important; /* 15px */
}

p, span, div, a, li, td, th, label,
input, select, textarea, button,
.nav-link, .dropdown-item, .card-title, .card-text,
.btn, .form-control, .table, .badge {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

/* Exclure les icônes Font Awesome de la police Roboto */
.fas, .fa-solid, .fa-fw, .fa, .far, .fal, .fab, .fa-brands,
i[class*="fa-"], i[class*="fas"], i[class*="far"], i[class*="fab"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Topbar */
.topbar {
    background-color: var(--pilperf-white) !important;
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.topbar .nav-link,
.topbar .navbar-nav,
.topbar .dropdown-item {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

/* Sidebar */
.sidebar,
.sidebar-dark,
.sidebar.sidebar-dark,
#accordionSidebar,
.navbar-nav.sidebar {
    background-color: #343640 !important;
    background: #343640 !important;
    font-family: var(--pilperf-font-family) !important; /* Roboto */
    font-size: 0.9375rem !important; /* 15px - légèrement augmenté */
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000 !important;
}

/* Scrollbar personnalisée pour le sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Pour Firefox */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9375rem !important; /* 15px - légèrement augmenté */
    font-family: var(--pilperf-font-family) !important; /* Roboto */
    padding: 0.5rem 1rem !important;
}

.sidebar .nav-link:hover {
    color: var(--pilperf-orange);
    background-color: rgba(255, 121, 0, 0.1);
}

.sidebar .nav-link.active {
    color: var(--pilperf-orange);
    background-color: rgba(255, 121, 0, 0.1);
}

.sidebar .sidebar-brand {
    /* Logo garde Helvetica - ne pas utiliser Roboto */
    font-family: Helvetica, Arial, sans-serif !important;
    padding: 1rem 0.5rem !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
    position: sticky !important;
    top: 0 !important;
    background-color: #343640 !important;
    z-index: 10 !important;
}

.sidebar .sidebar-brand:hover {
    text-decoration: none !important;
    opacity: 0.9;
}

.sidebar .sidebar-brand-text {
    /* Logo garde sa police d'origine (Helvetica) - ne pas utiliser Roboto */
    font-family: Helvetica, Arial, sans-serif !important;
    font-size: 1.1rem !important;
    font-weight: 700;
    color: #ffffff !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar .sidebar-brand-icon {
    color: var(--pilperf-orange) !important;
    font-size: 1.2rem !important;
}



.sidebar .sidebar-heading {
    font-family: var(--pilperf-font-family) !important; /* Roboto */
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar .dropdown-item {
    font-family: var(--pilperf-font-family) !important; /* Roboto */
    font-size: 0.8rem !important;
    padding: 0.5rem 1rem !important;
}

.sidebar .collapse-inner {
    font-family: var(--pilperf-font-family) !important; /* Roboto */
}

.sidebar .nav-item {
    font-family: var(--pilperf-font-family) !important; /* Roboto */
}

.sidebar .nav-item span {
    font-size: 0.9375rem !important; /* 15px - légèrement augmenté */
    font-family: var(--pilperf-font-family) !important; /* Roboto */
}

.sidebar .fas, .sidebar .fa-solid, .sidebar .fa-fw {
    font-size: 0.9375rem !important; /* 15px - légèrement augmenté */
    width: 1.25rem !important;
    display: inline-block !important;
    visibility: visible !important;
}

/* S'assurer que toutes les icônes Font Awesome sont visibles */
.fas, .fa-solid, .fa-fw, .fa, .far, .fal, .fab, .fa-brands,
i.fas, i.fa-solid, i.fa-fw, i.fa, i.far, i.fal, i.fab, i.fa-brands,
i[class*="fa-"], i[class*="fas"], i[class*="far"], i[class*="fab"],
[class*="fa-"]:not([class*="font"]):not([class*="family"]) {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
    display: inline-block !important;
    visibility: visible !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Spécifiquement pour les icônes dans les cards et autres éléments */
.card i.fas,
.card i.fa-solid,
.card i.fa-fw,
.card i.fa,
.col-auto i.fas,
.col-auto i.fa-solid,
.col-auto i.fa-fw,
.col-auto i.fa,
.dropdown i.fas,
.dropdown i.fa-solid,
.dropdown i.fa-fw,
.dropdown i.fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

/* Règles pour Material Icons */
.material-icons,
button.material-icons,
.btn.material-icons,
[class*="material-icons"] {
    font-family: 'Material Icons' !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-size: 24px !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    display: inline-block !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    direction: ltr !important;
    -webkit-font-feature-settings: 'liga' !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    font-feature-settings: 'liga' !important;
}

/* Permettre la taille personnalisée pour Material Icons */
.material-icons[style*="font-size"] {
    font-size: inherit !important;
}

.sidebar .sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    margin: 0.5rem 0 !important;
}

.sidebar .bg-gradient-primary,
.sidebar.bg-gradient-primary,
.bg-gradient-primary.sidebar {
    background-color: #343640 !important;
    background: #343640 !important;
    background-image: none !important;
}

/* Badges */
.badge-pilperf-orange {
    background-color: var(--pilperf-orange);
    color: var(--pilperf-white);
}

.badge-pilperf-black {
    background-color: var(--pilperf-black);
    color: var(--pilperf-white);
}

/* Tableaux */
.table {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.table thead th {
    background-color: var(--pilperf-gray-light);
    color: var(--pilperf-black);
    border-bottom: 2px solid var(--pilperf-orange);
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.table tbody tr:hover {
    background-color: var(--pilperf-gray-light);
}

.table td, .table th {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

/* Formulaires */
.form-control,
.form-group label,
.form-label {
    font-family: var(--pilperf-font-family) !important;
    font-size: var(--pilperf-font-size) !important;
}

.form-control:focus {
    border-color: var(--pilperf-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 121, 0, 0.25);
}

/* Alertes */
.alert-pilperf-orange {
    background-color: rgba(255, 121, 0, 0.1);
    border-color: var(--pilperf-orange);
    color: var(--pilperf-black);
}

/* Progress bars */
.progress-bar-pilperf-orange {
    background-color: var(--pilperf-orange);
}

/* Dropdown */
.dropdown-menu {
    border-color: var(--pilperf-gray-medium);
}

.dropdown-item:hover {
    background-color: rgba(255, 121, 0, 0.1);
    color: var(--pilperf-black);
}

/* Pagination */
.page-link {
    color: var(--pilperf-orange);
}

.page-link:hover {
    color: #e66a00;
    background-color: var(--pilperf-gray-light);
}

.page-item.active .page-link {
    background-color: var(--pilperf-orange);
    border-color: var(--pilperf-orange);
}

/* Tableau scrollable horizontal pour les 4 dernières semaines */
.table-responsive-container {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: relative !important;
}

.table-responsive-container table {
    width: max-content !important;
    min-width: 100% !important;
    margin-bottom: 0 !important;
    table-layout: auto !important;
    white-space: nowrap !important;
}

/* Empêcher le débordement des tableaux */
.card-body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
}

.card {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
}

/* Empêcher tout débordement horizontal */
* {
    box-sizing: border-box !important;
}

body, html, #wrapper, #content-wrapper, #content, .container-fluid {
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

/* Scrollbar personnalisée pour les tableaux */
.table-responsive-container::-webkit-scrollbar {
    height: 8px;
}

.table-responsive-container::-webkit-scrollbar-track {
    background: var(--pilperf-gray-light);
    border-radius: 4px;
}

.table-responsive-container::-webkit-scrollbar-thumb {
    background: var(--pilperf-gray-dark);
    border-radius: 4px;
}

.table-responsive-container::-webkit-scrollbar-thumb:hover {
    background: var(--pilperf-black);
}

/* Pour Firefox */
.table-responsive-container {
    scrollbar-width: thin;
    scrollbar-color: var(--pilperf-gray-dark) var(--pilperf-gray-light);
}

/* Footer fixé en bas de page */
html, body {
    height: 100% !important;
    overflow-x: hidden !important;
}

#wrapper {
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: hidden !important;
}

#content-wrapper {
    display: flex !important;
    flex-direction: column !important;
    min-height: calc(100vh - 60px) !important; /* Hauteur moins le footer */
    width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

#content {
    flex: 1 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
    position: relative !important;
}

/* Container fluid ne doit pas déborder */
.container-fluid {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding-bottom: 1rem !important;
}

/* Empêcher les rows de déborder */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.row > [class*="col-"] {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Footer fixé en bas - structure comme wecare (en dehors du wrapper) */
.sticky-footer {
    width: 100% !important;
    padding: 1rem 0 !important;
    background-color: var(--pilperf-white) !important;
    border-top: 1px solid var(--pilperf-gray-medium) !important;
    position: relative !important;
    z-index: 10 !important;
    clear: both !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ajuster le footer selon l'état du sidebar */
body:not(.sidebar-toggled) .sticky-footer {
    margin-left: 14rem !important;
    width: calc(100% - 14rem) !important;
}

body.sidebar-toggled .sticky-footer {
    margin-left: 4.5rem !important;
    width: calc(100% - 4.5rem) !important;
}

/* Sur mobile, le footer prend toute la largeur */
@media (max-width: 768px) {
    .sticky-footer {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

.sticky-footer .container {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
}

.sticky-footer .copyright {
    font-size: 0.875rem !important;
    color: var(--pilperf-gray-dark) !important;
    margin: 0 !important;
}

/* Ajustement du footer quand le sidebar est réduit - déjà géré ci-dessus */

/* Responsive: Footer sur mobile */
@media (max-width: 768px) {
    .sticky-footer {
        padding: 0.75rem 0 !important;
    }
    
    .sticky-footer .copyright {
        font-size: 0.75rem !important;
    }
    
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Sidebar Toggle Styles */
.sidebar #sidebarToggle {
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar #sidebarToggle::after {
    font-weight: 900;
    content: '\f104';
    font-family: 'Font Awesome 6 Free';
    margin-right: 0.1rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar #sidebarToggle:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.sidebar #sidebarToggle:focus {
    outline: 0;
}

/* Sidebar Toggled State - Mode réduit (icônes uniquement) */
.sidebar.toggled {
    width: 4.5rem !important; /* Largeur réduite pour afficher seulement les icônes */
}

.sidebar.toggled #sidebarToggle::after {
    content: '\f105'; /* Flèche vers la droite pour indiquer qu'on peut rouvrir */
}

body.sidebar-toggled .sidebar {
    width: 4.5rem !important; /* Largeur réduite */
}

body.sidebar-toggled #content-wrapper {
    margin-left: 4.5rem !important; /* Ajuster le contenu pour la sidebar réduite */
}

/* Assurer que le content-wrapper a une transition fluide */
#content-wrapper {
    transition: margin-left 0.3s ease;
}

/* Sidebar - transition fluide pour la largeur */
.sidebar {
    transition: width 0.3s ease;
    display: flex !important;
    flex-direction: column !important;
}

/* Conteneur des éléments du menu dans le sidebar */
.sidebar.navbar-nav,
#accordionSidebar {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Le conteneur du toggle reste en bas */
.sidebar .text-center {
    margin-top: auto !important;
    padding-top: 1rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Topbar Sidebar Toggle */
.topbar #sidebarToggleTop {
    cursor: pointer;
}

.topbar #sidebarToggleTop:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.topbar #sidebarToggleTop:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* When sidebar is toggled, hide text and show only icons */
.sidebar.toggled .sidebar-brand-text {
    display: none !important; /* Cacher le texte du logo */
}

.sidebar.toggled .sidebar-brand {
    justify-content: center !important; /* Centrer l'icône du logo */
    padding: 1rem 0.5rem !important;
}

.sidebar.toggled .nav-link span {
    display: none !important; /* Cacher le texte des liens */
}

.sidebar.toggled .nav-link {
    justify-content: center !important; /* Centrer les icônes */
    padding: 0.75rem 0.5rem !important;
}

.sidebar.toggled .nav-item .nav-link i {
    margin-right: 0 !important; /* Pas de marge à droite pour l'icône */
}

/* Cacher les menus accordion quand le sidebar est réduit */
.sidebar.toggled .nav-item .collapse {
    display: none !important;
}

.sidebar.toggled .nav-item .collapsing {
    display: none !important;
}

/* Cacher les headings quand le sidebar est réduit */
.sidebar.toggled .sidebar-heading {
    display: none !important;
}

/* Cacher les dividers quand le sidebar est réduit (optionnel) */
.sidebar.toggled .sidebar-divider {
    margin: 0.5rem 0.25rem !important;
}

/* Centrer le bouton toggle quand le sidebar est réduit */
.sidebar.toggled #sidebarToggle {
    margin: 0 auto !important;
}

/* Le bouton toggle reste visible en bas du sidebar */
.sidebar #sidebarToggle {
    position: sticky !important;
    bottom: 0 !important;
    background-color: #343640 !important;
    z-index: 10 !important;
    margin-top: auto !important;
}

/* Tooltips pour les icônes quand le sidebar est réduit */
.sidebar.toggled .nav-link {
    position: relative;
}

.sidebar.toggled .nav-link:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--pilperf-black);
    color: white;
    border-radius: 0.25rem;
    white-space: nowrap;
    z-index: 1001;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar.toggled .nav-link:hover::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: -0.25rem;
    border: 0.25rem solid transparent;
    border-right-color: var(--pilperf-black);
    z-index: 1002;
}

/* Responsive: Close sidebar completely on mobile when toggled */
@media (max-width: 768px) {
    .sidebar.toggled {
        width: 0 !important;
        overflow: hidden;
    }
    
    body.sidebar-toggled .sidebar {
        width: 0 !important;
        overflow: hidden;
    }
    
    body.sidebar-toggled #content-wrapper {
        margin-left: 0 !important;
    }
}

/* Page « Fichiers téléchargeables » : le thème impose overflow-x: hidden sur .card /
   .card-body, ce qui rogne les tableaux larges sans barre de défilement. */
.card.files-table-card {
    overflow-x: visible !important;
}
.card.files-table-card .card-body {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}
.files-table-card .files-table-scroll.table-responsive-container table {
    white-space: normal !important;
    min-width: 100% !important;
    width: 100% !important;
    table-layout: auto !important;
}
.card.files-table-card .dataTables_wrapper {
    overflow-x: auto !important;
    max-width: 100% !important;
}
/* Flex : permettre au bloc contenu de rétrécir pour que la zone scrollable fonctionne */
#content:has(.files-table-card) {
    min-width: 0 !important;
}
#content .container-fluid:has(.files-table-card) {
    min-width: 0 !important;
    overflow-x: visible !important;
}

/* Page détail backlog (clic sur une carte KPI) : scroll horizontal.
   - flex: min-width:auto sur les enfants empêchait le scroll ; on force min-width:0 sur la chaîne.
   - DataTables scrollX : zone dédiée .dataTables_scrollBody */
.backlog-detail-root {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

#content:has(.backlog-detail-root) {
    min-width: 0 !important;
}

#content .container-fluid:has(.backlog-detail-root) {
    min-width: 0 !important;
    overflow-x: visible !important;
}

.card.backlog-kpi-detail-card {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: visible !important;
}

.card.backlog-kpi-detail-card .card-body {
    min-width: 0 !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

.card.backlog-kpi-detail-card .table-responsive-container.backlog-table-scroll {
    min-width: 0 !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

.card.backlog-kpi-detail-card .dataTables_wrapper {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: visible !important;
}

.card.backlog-kpi-detail-card .dataTables_scrollBody {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

.card.backlog-kpi-detail-card .dataTables_scrollHead {
    overflow-x: hidden !important;
}

.card.backlog-kpi-detail-card .table-responsive-container.backlog-table-scroll table,
.card.backlog-kpi-detail-card table.dataTable {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: auto !important;
    white-space: nowrap !important;
}

.card.backlog-kpi-detail-card td.text-wrap,
.card.backlog-kpi-detail-card th.text-wrap {
    white-space: normal !important;
}

/* Dashboards : ligne d’objectif KPI sous le titre de carte (<p> centré) */
#content .card .kpi-objectif-ligne,
.container-fluid .card .kpi-objectif-ligne {
    display: block;
    width: 100%;
    text-align: center !important;
    margin-top: 0;
    margin-bottom: 0.35rem;
    font-weight: 400 !important;
    color: #858796 !important;
}

/* Filtres période / ajustement : pas de débordement hors carte (flex + .form-control width 100%) */
.filters-period-ajustement .filter-block-period,
.filters-period-ajustement .filter-block-adjustment {
    min-width: 0;
    max-width: 100%;
}
.filters-period-ajustement .filter-block-period form,
.filters-period-ajustement .filter-block-adjustment form {
    min-width: 0;
    max-width: 100%;
}
.filters-period-ajustement .period-selectors-row {
    min-width: 0;
    max-width: 100%;
}
.filters-period-ajustement .period-selectors-row .period-type-selector {
    width: auto !important;
    max-width: 100%;
    flex: 0 1 auto;
}
@media (min-width: 992px) {
    .filters-period-ajustement .period-selectors-row .period-type-selector {
        max-width: 13rem;
    }
}
.filters-period-ajustement .period-selectors-row .period-jour-input {
    width: auto !important;
    max-width: 100%;
    min-width: 0;
}

/* Plateaux sans ajustement : une ligne de contrôles (la classe .flex-wrap du partial a !important) */
.filters-period-only .period-selectors-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

/* Suivi instances PRC : menu déroulant « Afficher une section ».
   Les règles globales .card / .card-body (overflow-x: hidden) rognent le
   .dropdown-menu (liste tronquée à une ligne, barre de défilement parasite). */
.card.inst-prc-toolbar {
    overflow: visible !important;
}
.card.inst-prc-toolbar .card-body {
    overflow: visible !important;
}
.inst-prc-toolbar .dropdown-menu {
    z-index: 1035 !important;
}

/* Instances PRC : overlay plein écran + carrousel pendant le fetch JSON */
.inst-prc-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(28, 37, 54, 0.92);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.inst-prc-loading-overlay.inst-prc-loading--done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.inst-prc-loading-inner {
    max-width: 36rem;
}
.inst-prc-loading-overlay .carousel-inner p.lead {
    font-size: 1.1rem;
}

/* Navigation pleine page : l’utilisateur voit que la page suivante charge */
.pilperf-page-loader {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.pilperf-page-loader.is-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}
.pilperf-page-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(52, 54, 64, 0.4);
}
.pilperf-page-loader-panel {
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--pilperf-orange, #ff7900);
    max-width: 90vw;
}
.pilperf-page-loader-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 0.22rem;
    color: var(--pilperf-orange, #ff7900) !important;
}
.pilperf-page-loader-text {
    font-size: 0.95rem;
    color: var(--pilperf-black, #343640);
    font-weight: 600;
    text-align: center;
}
