/*
 * CCC360 — couche UI partagée (shell, composants transverses).
 *
 * Chargée APRÈS style.css (compilé depuis resources/scss). Feuille lisible et révisable à part :
 * les correctifs de mise en page du chantier UX (D-180) vivent ici plutôt que dans le CSS compilé
 * d'1,2 Mo, pour que chaque règle reste relisible en revue. Les couleurs passent par les jetons
 * --cc-* de resources/scss/ccc/_tokens.scss : aucune couleur claire codée en dur (mode sombre).
 */

:root {
    /* Échelle d'espacement 4/8/12/16/24/32 */
    --cc-space-1: 4px;
    --cc-space-2: 8px;
    --cc-space-3: 12px;
    --cc-space-4: 16px;
    --cc-space-5: 24px;
    --cc-space-6: 32px;
    /* Échelle typographique */
    --cc-fs-xs: 0.6875rem;
    --cc-fs-sm: 0.8125rem;
    --cc-fs-md: 0.875rem;
    --cc-fs-lg: 1rem;
    --cc-fs-xl: 1.25rem;
    --cc-fs-2xl: 1.5rem;
    --cc-sidebar-fg: #a9bec5;
    --cc-sidebar-fg-strong: #e8f0f2;
    --cc-sidebar-line: rgba(226, 232, 234, 0.08);
    --cc-sidebar-hover: rgba(255, 255, 255, 0.08);
    --cc-focus: 0 0 0 3px color-mix(in srgb, var(--cc-primary) 35%, transparent);
}

/* ══════════════════════════════════════════════════════════════════════════
   1. SHELL — barre latérale : carte profil + déconnexion épinglée (D-180)
   ══════════════════════════════════════════════════════════════════════════ */

/* Colonne flexible : logo, carte profil et pied gardent leur hauteur, le menu défile entre eux.
   Remplace les hauteurs en pixels posées par script.js (fenêtre - 60), qui poussaient le bas
   du menu hors de l'écran dès que la carte profil était affichée. */
.sidebar.cc-sidebar {
    display: flex !important;
    flex-direction: column;
}
.sidebar.cc-sidebar > .sidebar-logo,
.sidebar.cc-sidebar > .sidebar-header,
.sidebar.cc-sidebar > .cc-sidebar-footer {
    flex: 0 0 auto;
}
.sidebar.cc-sidebar > .slimScrollDiv,
.sidebar.cc-sidebar > .sidebar-inner {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
}
.sidebar.cc-sidebar > .slimScrollDiv > .sidebar-inner {
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}
.sidebar.cc-sidebar.d-none {
    display: none !important;
}

/* La carte profil est affichée dans tous les modes (le thème la masquait hors « sans en-tête »). */
.sidebar.cc-sidebar > .sidebar-header {
    display: block !important;
}
.cc-sidebar .sidebar-profile,
.cc-sidebar .cc-sidebar-company {
    min-width: 0;
}
.cc-sidebar .sidebar-profile-info,
.cc-sidebar .cc-sidebar-company-info {
    min-width: 0;
    flex: 1 1 auto;
}
.cc-sidebar .sidebar-profile-info h6,
.cc-sidebar .sidebar-profile-info p {
    line-height: 1.3;
}
.cc-sidebar .cc-sidebar-do {
    margin-top: 2px;
}
.cc-sidebar .cc-sidebar-shortcuts {
    gap: var(--cc-space-1);
}

/* Écrans bas (≤ 768 px) : la carte se compacte pour laisser le menu respirer. */
@media (max-height: 800px) {
    .cc-sidebar .cc-sidebar-company {
        display: none !important;
    }
    .cc-sidebar .sidebar-header {
        padding-top: var(--cc-space-2) !important;
    }
}

/* Libellés du menu : le thème « barre claire » (data-sidebar="light", défaut) colorait les <span>
   en gris foncé alors que le shell CCC peint la barre en sombre — libellés quasi invisibles.
   Les libellés héritent de la couleur du lien (shell) ; les libellés longs sont tronqués. */
.cc-sidebar .sidebar-menu a > span:not(.menu-arrow):not(.badge),
.cc-sidebar .sidebar-menu a > i {
    color: inherit !important;
}
.cc-sidebar .sidebar-menu a {
    min-width: 0;
}
.cc-sidebar .sidebar-menu a > span:not(.menu-arrow):not(.badge) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pied de barre latérale */
.cc-sidebar-footer {
    border-top: 1px solid var(--cc-sidebar-line);
    padding: var(--cc-space-2) var(--cc-space-3);
}
.cc-sidebar-logout {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--cc-radius-sm);
    color: var(--cc-sidebar-fg);
    display: flex;
    font-size: 0.83rem;
    font-weight: 600;
    gap: var(--cc-space-2);
    min-height: 36px;
    padding: var(--cc-space-2) var(--cc-space-3);
    text-align: left;
    width: 100%;
}
.cc-sidebar-logout i {
    font-size: 1.05rem;
}
.cc-sidebar-logout:hover {
    background: var(--cc-sidebar-hover);
    color: var(--cc-sidebar-fg-strong);
}
.cc-sidebar-logout:focus-visible {
    outline: 2px solid var(--cc-accent-brand);
    outline-offset: 2px;
}

/* Barre latérale claire : contraste du pied et de la carte */
[data-sidebar="light"] .cc-sidebar-footer,
[data-sidebar="light"] .cc-sidebar-logout {
    --cc-sidebar-line: var(--cc-border);
}

/* Mode réduit (bouton « réduire » ou disposition « Mini ») : icônes seules, libellés accessibles. */
@media (min-width: 992px) {
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .sidebar-header {
        padding-left: var(--cc-space-2) !important;
        padding-right: var(--cc-space-2) !important;
    }
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .cc-sidebar-company,
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .cc-sidebar-shortcuts,
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .sidebar-profile-info,
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .cc-sidebar-logout-label {
        display: none !important;
    }
    body.mini-sidebar:not(.expand-menu) .cc-sidebar .sidebar-profile {
        background: transparent !important;
        border-color: transparent !important;
        justify-content: center;
        padding: var(--cc-space-1) 0 !important;
    }
    body.mini-sidebar:not(.expand-menu) .cc-sidebar-footer {
        padding: var(--cc-space-2) var(--cc-space-1);
    }
    body.mini-sidebar:not(.expand-menu) .cc-sidebar-logout {
        justify-content: center;
        padding: var(--cc-space-2) 0;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   2. BARRES DE FILTRES — disposition partagée (en-têtes de tableaux de bord)
   ══════════════════════════════════════════════════════════════════════════ */

/* Select2 impose `width: 100% !important` à son conteneur. Dans une rangée flexible, ce 100 %
   vaut la largeur de la rangée entière : les voisins (dates, boutons Excel / Imprimer) débordaient
   alors par-dessus les champs. Dans une rangée flex, le sélecteur prend une base raisonnable et
   peut rétrécir. Les .input-group gardent leur règle (global-select2). */
.d-flex > .select2-container:not(.cc-s2-inline),
.d-inline-flex > .select2-container:not(.cc-s2-inline),
.cc-filter-row > .select2-container:not(.cc-s2-inline) {
    flex: 1 1 9rem;
    max-width: min(100%, 20rem);
    min-width: 7rem !important; /* lève le min-width: 100% !important du thème */
    width: auto !important;
}
/* Une rangée qui porte un Select2 peut passer à la ligne plutôt qu'élargir la page. */
.d-flex:has(> .select2-container),
.d-inline-flex:has(> .select2-container) {
    flex-wrap: wrap;
    min-width: 0;
}

/* Rangée de filtres : retour à la ligne, pas de largeur minimale implicite, espacement régulier. */
.cc-filter-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-space-2);
    min-width: 0;
}
.cc-filter-row > * {
    min-width: 0;
}
.cc-filter-row .form-control,
.cc-filter-row .form-select {
    flex: 0 1 auto;
    width: auto;
}
.cc-filter-row input[type="date"],
.cc-filter-row input[type="month"] {
    flex: 0 1 9.5rem;
    min-width: 8.5rem;
    width: 9.5rem;
}
.cc-filter-row .cc-filter-sep {
    color: var(--cc-text-3);
}

/* En-tête de page : titre à gauche, filtres et actions à droite ; les actions passent sous le
   titre quand la place manque au lieu de chevaucher. */
.cc-page-head {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-space-3) var(--cc-space-4);
    justify-content: space-between;
    margin-bottom: var(--cc-space-5);
    min-width: 0;
}
.cc-page-head__title {
    align-items: center;
    display: flex;
    flex: 1 1 18rem;
    gap: var(--cc-space-3);
    min-width: 0;
}
.cc-page-head__title > div {
    min-width: 0;
}
.cc-page-head__title .page-title {
    overflow-wrap: anywhere;
}
.cc-page-head__actions {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: var(--cc-space-2);
    justify-content: flex-end;
    margin-left: auto;
    max-width: 100%;
    min-width: 0;
}
@media (max-width: 767.98px) {
    .cc-page-head__actions {
        justify-content: flex-start;
        margin-left: 0;
        width: 100%;
    }
}

/* En-têtes historiques (.page-header > .row > .col + .col-auto) : la colonne d'actions peut
   passer à la ligne et rétrécir au lieu d'élargir la page. */
.page-header > .row > .col-auto {
    max-width: 100%;
    min-width: 0;
}
.page-header > .row > .col {
    min-width: min(100%, 16rem);
}

/* ══════════════════════════════════════════════════════════════════════════
   3. CARTES INDICATEURS (KPI) — pas de texte qui déborde ni ne se chevauche
   ══════════════════════════════════════════════════════════════════════════ */
.card-body .d-flex > div:not(.avatar):not(.progress) {
    min-width: 0;
}
.card-body .d-flex.justify-content-between {
    gap: var(--cc-space-2);
}
.card-body .d-flex.justify-content-between > small,
.card-body .d-flex.justify-content-between > span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.card-body h2,
.card-body h3,
.card-body h4 {
    overflow-wrap: anywhere;
}
.card-body .avatar {
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   4. BARRE SUPÉRIEURE — une seule ligne, libellés tronqués avant de passer à la ligne
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 992px) {
    .cc-topbar .nav.user-menu {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: var(--cc-space-1);
        min-width: 0;
    }
    .cc-topbar .nav.user-menu > li {
        flex-shrink: 0;
    }
    .cc-topbar .nav.user-menu > li.nav-searchinputs {
        flex: 0 1 248px;
        margin-right: auto;
        min-width: 140px;
    }
    .cc-topbar .nav.user-menu > li.main-drop:not(.profile-nav),
    .cc-topbar .nav.user-menu > li.cc-do-single {
        flex-shrink: 1;
        min-width: 0;
    }
    .cc-topbar .nav.user-menu .user-detail .user-name,
    .cc-topbar .cc-do-single-label strong {
        display: inline-block;
        max-width: 14rem;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: bottom;
        white-space: nowrap;
    }
}
/* Sous 1400 px : le sélecteur « société » passe en icône (la carte profil de la barre latérale porte
   déjà le nom) ; sous 1200 px le nom du DO se réduit à ses initiales. */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .cc-topbar .select-store-dropdown .user-detail,
    .cc-topbar .cc-do-single-prefix {
        display: none;
    }
    .cc-topbar .nav.user-menu .user-detail .user-name,
    .cc-topbar .cc-do-single-label strong {
        max-width: 9rem;
    }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .cc-topbar .cc-do-switcher .user-detail {
        display: none;
    }
    .cc-topbar [data-tour-id="topbar-primary-action"] {
        font-size: 0;
        gap: 0;
    }
    .cc-topbar [data-tour-id="topbar-primary-action"] i {
        font-size: 1rem;
        margin: 0 !important;
    }
}

/* Sélecteur de DO (composant shell, D-184) */
.cc-do-initials {
    align-items: center;
    background: var(--cc-primary);
    border-radius: var(--cc-radius-sm);
    color: #fff;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 700;
    height: 28px;
    justify-content: center;
    width: 28px;
}
.cc-do-menu {
    max-height: min(70vh, 28rem);
    min-width: 16rem;
    overflow-y: auto;
}
.cc-do-menu .dropdown-item.active,
.cc-do-menu .dropdown-item[aria-current="true"] {
    background: var(--cc-primary-tint);
    color: var(--cc-primary);
    font-weight: 700;
}
.cc-do-single {
    align-items: center;
    display: flex;
}
.cc-do-single-label {
    align-items: center;
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-pill);
    color: var(--cc-text-2);
    display: inline-flex;
    font-size: var(--cc-fs-sm);
    gap: var(--cc-space-1);
    padding: var(--cc-space-1) var(--cc-space-3);
    white-space: nowrap;
}
.cc-do-single-label strong {
    color: var(--cc-text-1);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════
   5. PANNEAU D'AIDE CONTEXTUELLE (D-185)
   ══════════════════════════════════════════════════════════════════════════ */
.cc-drawer {
    background: var(--cc-bg-surface);
    color: var(--cc-text-1);
}
.offcanvas.offcanvas-end.cc-drawer {
    max-width: 100vw;
    width: var(--bs-offcanvas-width, 440px) !important;
}
.cc-drawer .offcanvas-header,
.cc-drawer .offcanvas-footer {
    border-color: var(--cc-border) !important;
}
.cc-drawer .min-w-0 {
    min-width: 0;
}
.cc-help-summary {
    color: var(--cc-text-2);
    font-size: var(--cc-fs-md);
    margin-bottom: var(--cc-space-4);
}
.cc-help-section {
    border-top: 1px solid var(--cc-border);
    font-size: var(--cc-fs-sm);
    padding: var(--cc-space-3) 0;
}
.cc-help-section h6 {
    color: var(--cc-text-1);
    font-size: var(--cc-fs-md);
    font-weight: 700;
    margin-bottom: var(--cc-space-2);
}
.cc-help-section ul:not(.list-unstyled) {
    padding-left: 1.1rem;
    list-style: disc;
}
.cc-help-section li + li {
    margin-top: var(--cc-space-1);
}
.cc-help-empty {
    align-items: center;
    color: var(--cc-text-2);
    display: flex;
    flex-direction: column;
    gap: var(--cc-space-2);
    padding: var(--cc-space-5) 0;
    text-align: center;
}
.cc-help-empty i {
    color: var(--cc-text-3);
    font-size: 2rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   6. THÈME — explication des portées (/settings/theme) et personnaliseur (D-186)
   ══════════════════════════════════════════════════════════════════════════ */
.cc-scope-explainer {
    background: var(--cc-bg-subtle);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-md);
    color: var(--cc-text-2);
    font-size: var(--cc-fs-sm);
    padding: var(--cc-space-4);
}
.cc-scope-explainer h6 {
    color: var(--cc-text-1);
}
.cc-scope-explainer ol {
    padding-left: 1.1rem;
    list-style: decimal;
}
.cc-scope-explainer li + li {
    margin-top: var(--cc-space-1);
}
.sidebar-themesettings.offcanvas-end {
    max-width: 100vw;
}

/* ══════════════════════════════════════════════════════════════════════════
   7. FORMULAIRES — hauteurs et états (éditable, lecture seule, désactivé, erreur, focus)
   ══════════════════════════════════════════════════════════════════════════ */
:root {
    --cc-control-h: 38px;
    --cc-control-h-sm: 31px;
}
/* Le thème d'origine retire tout contour de focus (`* { outline: none }`, `button:focus
   { box-shadow: none !important }`) : la navigation clavier était invisible. */
.page-wrapper a:focus-visible,
.page-wrapper button:focus-visible,
.page-wrapper .btn:focus-visible,
.page-wrapper [tabindex]:focus-visible,
.page-wrapper .select2-selection:focus-visible,
.header a:focus-visible,
.header button:focus-visible,
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.offcanvas a:focus-visible,
.offcanvas button:focus-visible {
    outline: 2px solid var(--cc-primary) !important;
    outline-offset: 2px;
}
.form-control:focus,
.form-select:focus,
.select2-container--focus .select2-selection {
    border-color: var(--cc-primary) !important;
    box-shadow: var(--cc-focus) !important;
}
.form-control[readonly]:not([type="date"]):not(.flatpickr-input):not(.datetimepicker) {
    background-color: var(--cc-bg-subtle);
    border-style: dashed;
    color: var(--cc-text-2);
}
.form-control:disabled,
.form-select:disabled,
.select2-container--disabled .select2-selection {
    background-color: var(--cc-neutral-bg) !important;
    color: var(--cc-text-3) !important;
    cursor: not-allowed;
    opacity: 1;
}
.form-control.is-invalid,
.form-select.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--cc-danger) !important;
}
.invalid-feedback {
    color: var(--cc-danger);
}
.form-label {
    color: var(--cc-text-1);
    font-weight: 600;
    margin-bottom: var(--cc-space-1);
}

/* ══════════════════════════════════════════════════════════════════════════
   8. CARTES, EN-TÊTES SOMBRES, TABLEAUX, ÉTATS VIDES
   ══════════════════════════════════════════════════════════════════════════ */
/* Titres posés sur un fond sombre (card-header bg-dark text-white) : le thème forçait la couleur
   des h1–h6 en gris foncé, rendant « Analyse automatique » (SLA) invisible. */
.text-white :is(h1, h2, h3, h4, h5, h6, .card-title),
.bg-dark.text-white :is(h1, h2, h3, h4, h5, h6, .card-title) {
    color: inherit !important;
}
.card-header {
    border-color: var(--cc-border);
}
.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--cc-bg-subtle);
}
.table > :not(caption) > * > * {
    border-color: var(--cc-border);
}
.table-responsive > .table > thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
.table td.text-center.text-muted,
.dataTables_empty {
    color: var(--cc-text-3) !important;
    padding: var(--cc-space-5) var(--cc-space-4) !important;
}
.btn-icon,
.btn.btn-icon {
    min-height: 32px;
    min-width: 32px;
}

/* ══════════════════════════════════════════════════════════════════════════
   9. MODE SOMBRE — surfaces des composants partagés sans blanc codé en dur
   ══════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--cc-bg-surface);
    border-color: var(--cc-border-strong);
}
[data-theme="dark"] select.select2-hidden-accessible {
    border: 0 !important;
}
[data-theme="dark"] .cc-sidebar .sidebar-header .bg-white,
[data-theme="dark"] .page-wrapper .bg-white:not(.btn) {
    background-color: var(--cc-bg-surface) !important;
}

/* Graphiques : un canvas Chart.js ne déborde jamais de sa carte (qualité à 1024 px : +11 px). */
.card-body canvas {
    max-width: 100% !important;
}
.card-body {
    min-width: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   10. EN-TÊTE AVEC INDICATEURS (D-220) — titre | indicateurs | actions
   ══════════════════════════════════════════════════════════════════════════ */
/* Moyenne largeur : titre et actions sur une ligne, indicateurs en dessous sur toute la largeur. */
.cc-page-header.cc-page-header--with-indicators {
    align-items: center;
    display: grid;
    gap: var(--cc-space-3) var(--cc-space-4);
    grid-template-areas:
        "main actions"
        "indicators indicators";
    grid-template-columns: minmax(0, 1fr) auto;
}
.cc-page-header--with-indicators > .cc-page-header__main {
    grid-area: main;
    min-width: 0;
}
.cc-page-header--with-indicators > .cc-page-indicators {
    grid-area: indicators;
}
.cc-page-header--with-indicators > .cc-page-actions {
    grid-area: actions;
    margin-top: 0;
    min-width: 0;
}
/* Grand écran : les indicateurs tiennent entre le titre et les boutons. Le titre se replie sur
   deux lignes avant de pousser les indicateurs ; ceux-ci passent sur deux rangées plutôt que de
   déborder quand l'espace manque (barre latérale dépliée à 1400 px). */
@media (min-width: 1400px) {
    .cc-page-header.cc-page-header--with-indicators {
        grid-template-areas: "main indicators actions";
        grid-template-columns: minmax(11rem, max-content) minmax(0, 1fr) auto;
    }
    .cc-page-header--with-indicators > .cc-page-header__main {
        max-width: 17rem;
    }
}
/* Mobile : titre, actions, puis indicateurs en 2 × 2 ; aucune largeur ne dépasse l'écran. */
@media (max-width: 767.98px) {
    .cc-page-header.cc-page-header--with-indicators {
        grid-template-areas:
            "main"
            "actions"
            "indicators";
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Conteneur interrogeable : quand la rangée est étroite (grand écran, barre latérale dépliée), les
   pictogrammes s'effacent et le libellé passe sous la valeur, pour garder les quatre sur une ligne. */
.cc-page-indicators {
    container-type: inline-size;
    display: grid;
    gap: var(--cc-space-2);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 6.25rem), 1fr));
    min-width: 0;
}
@media (max-width: 767.98px) {
    .cc-page-indicators {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cc-indicator {
    align-items: center;
    background: var(--cc-bg-surface);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-md);
    box-shadow: var(--cc-shadow-card);
    display: flex;
    gap: var(--cc-space-2);
    min-height: 3.25rem;
    min-width: 0;
    padding: var(--cc-space-2) var(--cc-space-3);
}
.cc-indicator__icon {
    align-items: center;
    background: var(--cc-info-bg);
    border-radius: var(--cc-radius-sm);
    color: var(--cc-info);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1rem;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}
.cc-indicator-tone-success .cc-indicator__icon { background: var(--cc-success-bg); color: var(--cc-success); }
.cc-indicator-tone-warning .cc-indicator__icon { background: var(--cc-warning-bg); color: var(--cc-warning); }
.cc-indicator-tone-danger .cc-indicator__icon { background: var(--cc-danger-bg); color: var(--cc-danger); }
.cc-indicator-tone-neutral .cc-indicator__icon { background: var(--cc-neutral-bg); color: var(--cc-neutral); }
.cc-indicator__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cc-indicator__head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-space-1) 0.375rem;
    min-width: 0;
}
.cc-indicator__value {
    color: var(--cc-text-1);
    font-size: 1.125rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    line-height: 1.15;
}
.cc-indicator__label {
    color: var(--cc-text-2);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cc-indicator__meta {
    color: var(--cc-text-3);
    font-size: 0.6875rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Retour du 20/11 : indicateur cliquable (lien vers la liste filtrée). */
a.cc-indicator--link {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.cc-indicator--link:hover,
a.cc-indicator--link:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .12), var(--cc-shadow-card);
    color: inherit;
    transform: translateY(-1px);
}
a.cc-indicator--active {
    border-color: var(--bs-primary);
    box-shadow: inset 0 -3px 0 var(--bs-primary), var(--cc-shadow-card);
}
/* Après les règles de base : à spécificité égale, la dernière l'emporte. */
@container (max-width: 34rem) {
    .cc-indicator {
        padding: var(--cc-space-1) var(--cc-space-2);
    }
    .cc-indicator__icon {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   11. MENU LATÉRAL — couleurs personnalisées (D-211)
   Chaque règle ne s'applique que si son jeton figure dans <html data-cc-sidebar="…"> : une couleur
   laissée vide rend la main au thème (palette, teinte, mode sombre). Les valeurs viennent des
   variables --cc-sidebar-* posées sur :root par head-css (portées utilisateur → DO → global).
   ══════════════════════════════════════════════════════════════════════════ */

/* Fond : l'image de fond (data-sidebarbg) garde la priorité quand elle est choisie. */
html[data-cc-sidebar~="bg"] body:not([data-sidebarbg]) #sidebar.sidebar {
    background: var(--cc-sidebar-bg) !important;
}
html[data-cc-sidebar~="bg"] body:not([data-sidebarbg]) #sidebar .sidebar-logo {
    background: transparent !important;
}

/* Texte des éléments, et des zones du menu qui en dépendent (carte profil, déconnexion). */
html[data-cc-sidebar~="text"] {
    --cc-sidebar-fg: var(--cc-sidebar-text);
}
html[data-cc-sidebar~="text"] #sidebar .sidebar-menu ul li a,
html[data-cc-sidebar~="text"] #sidebar .sidebar-menu ul li a .menu-arrow,
html[data-cc-sidebar~="text"] #sidebar .cc-sidebar-logout,
html[data-cc-sidebar~="text"] #sidebar .sidebar-header h6,
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .text-dark,
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .btn-icon {
    color: var(--cc-sidebar-text) !important;
}
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .text-muted {
    color: color-mix(in srgb, var(--cc-sidebar-text) 72%, transparent) !important;
}
/* Cartes et raccourcis de l'en-tête : un voile dérivé du texte, lisible sur fond clair comme sombre. */
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .border,
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .sidebar-profile,
html[data-cc-sidebar~="text"] #sidebar .sidebar-header .btn-icon {
    background: color-mix(in srgb, var(--cc-sidebar-text) 7%, transparent) !important;
    border-color: color-mix(in srgb, var(--cc-sidebar-text) 14%, transparent) !important;
}
html[data-cc-sidebar~="text"] #sidebar .sidebar-menu ul li a .menu-arrow::before {
    border-color: var(--cc-sidebar-text) !important;
}

html[data-cc-sidebar~="icon"] #sidebar .sidebar-menu ul li a > i,
html[data-cc-sidebar~="icon"] #sidebar .sidebar-menu ul li a > svg {
    color: var(--cc-sidebar-icon) !important;
}

html[data-cc-sidebar~="title"] #sidebar .submenu-hdr {
    color: var(--cc-sidebar-title) !important;
}

/* Survol — déclaré avant l'état sélectionné, qui l'emporte à spécificité égale. */
html[data-cc-sidebar~="hover-bg"] #sidebar .sidebar-menu ul li a:hover,
html[data-cc-sidebar~="hover-bg"] #sidebar .cc-sidebar-logout:hover {
    background: var(--cc-sidebar-hover-bg) !important;
}
html[data-cc-sidebar~="hover-text"] #sidebar .sidebar-menu ul li a:hover,
html[data-cc-sidebar~="hover-text"] #sidebar .sidebar-menu ul li a:hover > i,
html[data-cc-sidebar~="hover-text"] #sidebar .cc-sidebar-logout:hover {
    color: var(--cc-sidebar-hover-text) !important;
}

/* Élément sélectionné (lien actif, rubrique ouverte). */
html[data-cc-sidebar~="active-bg"] #sidebar .sidebar-menu ul li.active > a,
html[data-cc-sidebar~="active-bg"] #sidebar .sidebar-menu ul li a.active,
html[data-cc-sidebar~="active-bg"] #sidebar .sidebar-menu ul li.subdrop > a {
    background: var(--cc-sidebar-active-bg) !important;
}
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li.active > a,
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li.active > a > i,
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li a.active,
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li a.active > i,
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li.subdrop > a,
html[data-cc-sidebar~="active-text"] #sidebar .sidebar-menu ul li.subdrop > a > i {
    color: var(--cc-sidebar-active-text) !important;
}
html[data-cc-sidebar~="active-accent"] #sidebar .sidebar-menu ul li.active > a,
html[data-cc-sidebar~="active-accent"] #sidebar .sidebar-menu ul li a.active,
html[data-cc-sidebar~="active-accent"] #sidebar .sidebar-menu ul li.subdrop > a {
    box-shadow: inset 3px 0 0 var(--cc-sidebar-active-accent) !important;
}

/* Champ couleur facultatif (réglages, personnaliseur) : vide = couleur du thème. */
.cc-theme-color .settings-color-wrapper {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cc-space-2);
}
.cc-theme-color .settings-color-hex {
    max-width: 9rem;
}
.cc-theme-color.is-default .settings-color-picker {
    opacity: 0.45;
}
.cc-theme-color-state {
    color: var(--cc-text-3);
    font-size: var(--cc-fs-xs);
}

/* Personnaliseur : vignettes d'image de fond du menu, dont « Aucune image » (D-210). */
#theme-setting .theme-sidebarbg label {
    cursor: pointer;
    position: relative;
}
#theme-setting .theme-sidebarbg label img,
#theme-setting .theme-sidebarbg .cc-sidebarbg-none {
    height: 64px;
    object-fit: cover;
    width: 40px;
}
#theme-setting .theme-sidebarbg .cc-sidebarbg-none {
    background: var(--cc-bg-subtle);
    color: var(--cc-text-2);
}
#theme-setting .theme-sidebarbg input[type="radio"]:checked ~ label {
    outline: 2px solid var(--cc-primary);
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   11. BANDEAU COLORÉ ET AVATAR (D-215)
   ══════════════════════════════════════════════════════════════════════════ */

/* Avatar sans photo : initiales sur une pastille, à la taille du conteneur (user-letter, user-img, avatar). */
.cc-avatar-initials {
    align-items: center;
    background: var(--cc-primary);
    border-radius: inherit;
    color: #fff;
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 700;
    height: 100%;
    justify-content: center;
    letter-spacing: 0.02em;
    line-height: 1;
    min-height: 28px;
    min-width: 28px;
    text-transform: uppercase;
    width: 100%;
}
.avatar .cc-avatar-initials {
    font-size: 0.85rem;
}

/* Bandeau sombre ou teinté : le thème d'origine ne blanchissait que le bouton de menu ; les libellés
   (DO active, société) gardaient #1b2950, illisibles sur fond bleu. Ils prennent la couleur du texte
   du bandeau. data-cc-topbar-text est calculé par theme-script.js d'après le fond réellement affiché
   (les teintes vont du presque blanc au bleu nuit : la valeur de data-topbar ne suffit pas). */
html[data-cc-topbar-text="light"] {
    --cc-topbar-fg: #ffffff;
}
html[data-cc-topbar-text="light"] .header .user-menu .user-info .user-name,
html[data-cc-topbar-text="light"] .header .cc-do-switcher .dropdown-toggle,
html[data-cc-topbar-text="light"] .header .cc-do-switcher .dropdown-toggle::after,
html[data-cc-topbar-text="light"] .header .select-store-dropdown .dropdown-toggle::after,
html[data-cc-topbar-text="light"] .header .cc-do-single-label,
html[data-cc-topbar-text="light"] .header .cc-do-single-label strong {
    color: var(--cc-topbar-fg) !important;
    border-color: currentColor;
}
html[data-cc-topbar-text="light"] .header .cc-do-single-label {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   12. PETITS ÉCRANS — débordement horizontal à 390 px (D-228, lot C7 D-322)
   Le personnaliseur de thème (.sidebar-themesettings, offcanvas à droite, 400 px fixés en !important par
   _theme-setting.scss) reste dans le flux une fois translaté hors écran et élargit le document (515 px
   relevés à 390 px). Sous 576 px : panneau à la largeur de l'écran, retiré du rendu tant qu'il est fermé
   (Bootstrap ajoute .showing / .show / .hiding pendant l'ouverture et la fermeture), et rognage horizontal du
   document en dernier recours (clip ne crée pas de conteneur de défilement : position: sticky reste active).
   ========================================================================== */
@media (max-width: 575.98px) {
    .sidebar-themesettings.offcanvas.offcanvas-end {
        width: 100% !important;
        max-width: 100vw;
    }
    .sidebar-themesettings.offcanvas:not(.show):not(.showing):not(.hiding) {
        display: none;
    }
    html,
    body {
        overflow-x: clip;
    }
}

/* Recherche du bandeau (retour du 19/11) : résultats en lignes, groupés, sélection au clavier. */
.cc-search-dropdown {
    width: min(460px, calc(100vw - 32px));
    padding: 0;
    overflow: hidden;
}
.cc-search-hint {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--cc-border);
    color: var(--cc-text-2);
    font-size: var(--cc-fs-sm);
    line-height: 1.4;
}
.cc-search-hint > i {
    margin-top: 0.125rem;
    color: var(--cc-text-3);
}
.cc-search-scroll {
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding: 0.375rem 0;
}
.cc-search-group-title {
    margin: 0;
    padding: 0.5rem 0.875rem 0.25rem;
    color: var(--cc-text-3);
    font-size: var(--cc-fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.cc-search-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.cc-search-list > li.d-none {
    display: none !important;
}
.cc-search-result {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    padding: 0.4375rem 0.875rem;
    color: var(--cc-text-1);
    text-decoration: none;
}
.cc-search-result:hover,
.cc-search-result:focus-visible,
.cc-search-result.active {
    background: var(--cc-primary-tint);
    color: var(--cc-primary);
    outline: none;
}
.cc-search-result-icon {
    flex: 0 0 auto;
    margin-top: 0.125rem;
    font-size: 1rem;
    color: var(--cc-text-3);
}
.cc-search-result.active .cc-search-result-icon,
.cc-search-result:hover .cc-search-result-icon {
    color: var(--cc-primary);
}
.cc-search-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cc-search-result-label {
    font-size: var(--cc-fs-md);
    line-height: 1.35;
}
.cc-search-result-path {
    overflow: hidden;
    color: var(--cc-text-3);
    font-size: var(--cc-fs-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cc-search-empty {
    margin: 0;
    padding: 0.75rem 0.875rem;
    color: var(--cc-text-3);
    font-size: var(--cc-fs-sm);
}
