h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Module 2 — tableau de bord (§3.2) */

.cartes-synthese {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.carte-synthese {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    min-width: 180px;
}

.carte-synthese .valeur {
    font-size: 1.6rem;
    font-weight: 600;
}

.carte-synthese .libelle {
    color: #6c757d;
    font-size: 0.85rem;
}

.liste-groupes, .liste-utilisateurs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.carte-groupe {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    opacity: 0; /* état initial avant l'animation JS (dashboard-animations.js) */
}

.carte-groupe .entete {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.barre-progression-conteneur {
    background: #e9ecef;
    border-radius: 999px;
    height: 0.6rem;
    overflow: hidden;
    margin: 0.4rem 0;
}

.barre-progression-remplissage {
    height: 100%;
    width: 100%;
    transform-origin: left center;
    transform: scaleX(0); /* état initial — animé via GSAP, cf. dashboard-animations.js */
    border-radius: 999px;
}

.barre-progression-remplissage.niveau-vert { background: #2e7d32; }
.barre-progression-remplissage.niveau-orange { background: #ef6c00; }
.barre-progression-remplissage.niveau-rouge { background: #c62828; }

.alerte-clients-non-visites {
    color: #c62828;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Carte interactive 3D du Maroc (§3.2) — mode d'affichage alternatif de la vue consolidée. */

.bascule-affichage {
    margin: 1rem 0 0.5rem;
}

.carte3d {
    margin-top: 0.5rem;
}

.carte3d-barre {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.carte3d-titre {
    font-weight: 600;
    text-transform: capitalize;
}

.carte3d-scene {
    position: relative;
    height: 60vh;
    min-height: 380px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(180deg, #f7fafc 0%, #e8eef2 100%);
}

.carte3d-canevas {
    width: 100%;
    height: 100%;
}

/* L'infobulle suit le pointeur : positionnée en JS, elle ne doit jamais intercepter le survol
   des régions situées dessous. */
.carte3d-infobulle {
    position: absolute;
    pointer-events: none;
    background: rgba(38, 50, 56, 0.94);
    color: #fff;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    max-width: 15rem;
    z-index: 2;
}

.carte3d-chargement {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #546e7a;
    font-size: 0.9rem;
}

.carte3d-detail {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    background: #fff;
}

.carte3d-detail-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.carte3d-detail h4 {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.9rem;
}

.carte3d-liste {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.87rem;
    line-height: 1.5;
}

/* Historique mensuel (§3.2) — barres groupées objectif vs réalisé.
   Deux séries catégorielles issues d'une palette validée (séparation CVD et contraste vérifiés
   sur les deux surfaces) ; volontairement DISTINCTES des couleurs de seuil vert/orange/rouge,
   qui portent un état et ne doivent jamais servir d'identité de série. */

.viz-root {
    --surface-1: #ffffff;
    --text-secondary: #52514e;
    --grille: #e0e0e0;
    --serie-objectif: #2a78d6;
    --serie-realise: #eb6834;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .viz-root {
        --surface-1: #1a1a19;
        --text-secondary: #c3c2b7;
        --grille: #3a3a38;
        --serie-objectif: #3987e5;
        --serie-realise: #d95926;
    }
}

:root[data-theme="dark"] .viz-root {
    --surface-1: #1a1a19;
    --text-secondary: #c3c2b7;
    --grille: #3a3a38;
    --serie-objectif: #3987e5;
    --serie-realise: #d95926;
}

.hist-filtres {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0 1rem;
}

.hist-legende {
    display: flex;
    gap: 1.25rem;
    font-size: 0.87rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.hist-legende .pastille {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 3px;
    margin-right: 0.35rem;
    vertical-align: baseline;
}

.pastille.serie-objectif { background: var(--serie-objectif); }
.pastille.serie-realise  { background: var(--serie-realise); }

.hist-graphique {
    margin: 0 0 1.25rem;
}

.hist-graphique figcaption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

/* Le graphique défile horizontalement plutôt que d'écraser les barres sur 24 mois. */
.hist-barres {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 220px;
    padding-top: 0.5rem;
    border-bottom: 1px solid var(--grille);
    overflow-x: auto;
}

.hist-mois {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 3rem;
    height: 100%;
}

.hist-paire {
    display: flex;
    align-items: flex-end;
    /* 2px de surface entre deux barres adjacentes : les fills ne se touchent jamais. */
    gap: 2px;
    height: 100%;
    width: 100%;
    justify-content: center;
}

.hist-barre {
    width: 0.85rem;
    /* Extrémité arrondie côté donnée, ancrée à la ligne de base. */
    border-radius: 4px 4px 0 0;
    transition: filter 0.12s ease;
}

.hist-barre.serie-objectif { background: var(--serie-objectif); }
.hist-barre.serie-realise  { background: var(--serie-realise); }

.hist-mois:hover .hist-barre { filter: brightness(1.12); }

.hist-etiquette {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    white-space: nowrap;
}

.hist-utilisateur {
    border-top: 1px solid var(--grille);
    padding: 0.6rem 0;
}

.hist-utilisateur summary,
.hist-tableau summary {
    cursor: pointer;
}

.hist-tableau {
    margin-top: 1rem;
}

.hist-tableau-defilement {
    overflow-x: auto;
}

.hist-tableau table {
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.87rem;
}

.hist-tableau th,
.hist-tableau td {
    border: 1px solid var(--grille);
    padding: 0.3rem 0.6rem;
    text-align: right;
}

.hist-tableau th[scope="row"],
.hist-tableau th[scope="col"]:first-child {
    text-align: left;
}

@media (prefers-reduced-motion: reduce) {
    .hist-barre { transition: none; }
}
