/* Bandeau de mise a jour du front (nouvelle version deployee -> rechargement auto). */
.bandeau-nouvelle-version {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.6rem 1rem;
    text-align: center;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent-fonce);
    box-shadow: var(--ombre-legere);
}

:root {
    color-scheme: light;
    --fond-page: #eef3f0;
    --fond-panneau: #ffffff;
    --fond-soft: #f7faf8;
    --texte: #121c18;
    --texte-discret: #53645d;
    --bordure: #d5dfda;
    --bordure-forte: #c4d1cb;
    --accent: #147a58;
    --accent-fonce: #0d6045;
    --accent-pale: #e2f3ec;
    --danger: #b34a4a;
    --danger-pale: #fae9e9;
    --info: #315f8f;
    --ombre: 0 12px 32px rgba(22, 39, 31, 0.08);
    --ombre-legere: 0 4px 14px rgba(22, 39, 31, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--fond-page);
}

body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    color: var(--texte);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

noscript {
    display: block;
    max-width: 40rem;
    margin: 2rem auto;
    padding: 1rem;
    color: var(--danger);
    background: var(--danger-pale);
    border: 1px solid #efb7b7;
    border-radius: 8px;
}

.application {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 36px;
}

/* Vues « tableau » d'administration (beaucoup de colonnes) : on elargit le conteneur pour eviter le
   scroll horizontal quand l'ecran le permet, plutot que de rester bride a 1120px. */
.application-large {
    width: min(1600px, calc(100% - 40px));
}

/* ...et on leve le plafond de largeur propre a ces pages pour qu'elles remplissent le conteneur. */
.application-large .page-utilisateurs,
.application-large .page-vehicules {
    width: 100%;
}

.application-login,
.application-auth {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px 0;
}

/* Barre de navigation pleine largeur (hors conteneur centré .application). */
.entete {
    position: relative;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    color: #ffffff;
    background: var(--accent);
    box-shadow: 0 4px 14px rgba(22, 39, 31, 0.14);
}

.titre-app {
    cursor: pointer;
    border-radius: 6px;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    line-height: 1.1;
    white-space: nowrap;
    color: #ffffff;
}

.titre-app:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.55);
    outline-offset: 3px;
}

/* Numéro de version, en petit à côté du titre. */
.version-app {
    margin-left: 6px;
    font-size: 0.62em;
    font-weight: 600;
    vertical-align: super;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.02em;
}

/* Onglets principaux : alignés sur le bord gauche du contenu (.application) en dessous. */
.onglets {
    position: absolute;
    top: 50%;
    left: max(11rem, calc((100vw - 1120px) / 2));
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
}

.onglets button {
    min-height: 34px;
    padding: 7px 13px;
    color: #ffffff;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.onglets button.onglet-accueil {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
}

.onglets button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.onglets button.actif {
    color: var(--accent);
    background: #ffffff;
}

.onglets button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
}

.actions-entete {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.entete .session-utilisateur {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    white-space: nowrap;
}

.session-boutons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Boutons icônes de la barre (fixe, engrenage, hamburger, déconnexion). */
.bouton-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    padding: 0;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
}

.bouton-icone:hover,
.bouton-icone.actif {
    background: rgba(255, 255, 255, 0.26);
}

.bouton-icone:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
}

.icone {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Le hamburger n'apparaît qu'en vue mobile. */
.menu-mobile-bouton {
    display: none;
}

/* Dropdown Configuration (roue crantée, admin). */
.config-conteneur {
    position: relative;
    display: flex;
    align-items: center;
}

.config-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 12rem;
    padding: 5px;
    background: var(--fond-panneau);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    box-shadow: var(--ombre);
}

.config-dropdown button {
    width: 100%;
    padding: 9px 12px;
    color: var(--texte);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.config-dropdown button:hover {
    background: var(--fond-soft);
}

.config-dropdown button.actif {
    color: #ffffff;
    background: var(--accent);
}

/* Menu mobile déroulant (sous la barre). */
.menu-mobile {
    display: none;
}

/* Barre auto-masquée : cachée en haut, réapparaît au survol (desktop avec souris). */
.barre-zone-reveal {
    display: none;
}

.barre-fixe-toggle {
    display: none;
}

@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
    .barre-fixe-toggle {
        display: inline-flex;
    }

    .barre-zone-reveal {
        position: fixed;
        z-index: 999;
        top: 0;
        right: 0;
        left: 0;
        display: block;
        height: 46px;
    }

    .entete.entete-auto-masquee {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        transform: translateY(-100%);
        transition: transform 0.2s ease 0.65s;
        box-shadow: var(--ombre);
    }

    .barre-zone-reveal:hover + .entete.entete-auto-masquee,
    .entete.entete-auto-masquee:hover,
    .entete.entete-auto-masquee:focus-within {
        transform: translateY(0);
        transition-delay: 0s;
    }
}

.actions-vue {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 12px;
}

.surtitre,
.libelle {
    margin: 0 0 3px;
    color: var(--texte-discret);
    font-size: 0.82rem;
    font-weight: 600;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2.35rem, 4vw, 3.35rem);
    line-height: 0.98;
}

h2 {
    font-size: 1.35rem;
    line-height: 1.15;
}

h3 {
    font-size: 1.05rem;
    line-height: 1.2;
}

.grille-principale {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
    gap: 10px;
}

.panneau {
    min-width: 0;
    padding: 22px;
    background: var(--fond-panneau);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    box-shadow: var(--ombre);
}

.panneau-etat {
    grid-row: span 2;
}

.ligne-titre {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.badges-etat {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 10px;
    color: var(--texte-discret);
    background: #f0f5f2;
    border: 1px solid var(--bordure);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge.actif {
    color: var(--accent-fonce);
    background: var(--accent-pale);
    border-color: #a9dcca;
}

.badge-clim.actif {
    color: #214f87;
    background: #e5f0fb;
    border-color: #b9d4f1;
}

.badge-wb-hs {
    color: #9b1c1c;
    background: #fde2e1;
    border-color: #f5b5b2;
}

/* Type de charge (historique) : lente / moyenne / rapide (DC) / inconnu. */
.badge-type-lente {
    color: #4a5568;
    background: #eef1f4;
    border-color: #d3dae1;
}

.badge-type-moyenne {
    color: #214f87;
    background: #e5f0fb;
    border-color: #b9d4f1;
}

.badge-type-rapide {
    color: #8a4b0a;
    background: #fde7d3;
    border-color: #f2cc93;
}

.badge-type-inconnu {
    color: var(--texte-discret);
    background: #f0f5f2;
    border-color: var(--bordure);
}

/* Indicateur combiné borne : maison + prise (présence voiture) + point (santé wallbox). */
.lien-wallbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 4px;
    cursor: default;
}

.lien-wallbox-icones {
    color: var(--accent);
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Voiture hors périmètre : maison + prise grisées. Ce n'est pas une alerte (pas de rouge). */
.lien-wallbox.voiture-absente .lien-wallbox-icones {
    color: var(--texte-discret);
    opacity: 0.4;
}

.lien-wallbox-point {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a34a; /* vert = wallbox en ligne */
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.lien-wallbox.wallbox-hors-ligne .lien-wallbox-point {
    background: #dc2626; /* rouge = wallbox injoignable */
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18);
}

.icone-badge {
    line-height: 1;
}

.batterie {
    margin: 16px 0 24px;
}

.batterie strong {
    font-size: clamp(1.6rem, 6vw, 2.5rem);
    line-height: 1;
    color: #ffffff;
    text-shadow:
        0 1px 2px rgba(13, 45, 34, 0.55),
        0 0 3px rgba(13, 45, 34, 0.4);
    white-space: nowrap;
}

.batterie strong span {
    font-size: 0.42em;
}

/* Valeur superposée, centrée dans la jauge. */
.batterie-valeur {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
}

/* Bouton d'actualisation superposé, calé à droite. */
.bouton-actualiser-batterie {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--texte-discret);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: var(--ombre-legere);
}

.bouton-actualiser-batterie:hover:not(:disabled) {
    color: var(--accent-fonce);
    border-color: var(--bordure-forte);
}

.bouton-actualiser-batterie:focus-visible {
    outline: 3px solid rgba(44, 95, 158, 0.28);
    outline-offset: 2px;
}

.bouton-actualiser-batterie:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

/* Case kilometrage : conteneur de reference pour centrer verticalement le bouton sur toute la case
   (comme le bouton batterie dans sa jauge), pas seulement sur la ligne de la valeur. */
.metrique-kilometrage {
    position: relative;
}

/* Espace reserve a droite pour que la valeur ne passe pas sous le bouton. */
.valeur-kilometrage {
    padding-right: 38px;
}

/* Bouton d'actualisation du kilometrage : meme style que celui de la batterie. */
.bouton-actualiser-kilometrage {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--texte-discret);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: var(--ombre-legere);
}

.bouton-actualiser-kilometrage:hover:not(:disabled) {
    color: var(--accent-fonce);
    border-color: var(--bordure-forte);
}

.bouton-actualiser-kilometrage:focus-visible {
    outline: 3px solid rgba(44, 95, 158, 0.28);
    outline-offset: 2px;
}

.bouton-actualiser-kilometrage:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.batterie-jauge {
    position: relative;
    height: 86px;
    overflow: hidden;
    background: #e6eeea;
    border: 1px solid var(--bordure-forte);
    border-radius: 8px;
}

.batterie-remplissage {
    position: relative;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    background: linear-gradient(90deg, var(--accent), #4aa478);
    transition: width 180ms ease-out;
}

/* Effet « flux » : bandes diagonales qui défilent pendant la charge. */
.batterie-remplissage.en-charge::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        115deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0) 14px,
        rgba(255, 255, 255, 0.3) 14px,
        rgba(255, 255, 255, 0.3) 28px
    );
    background-size: 56px 100%;
    animation: batterie-flux 0.9s linear infinite;
}

@keyframes batterie-flux {
    to {
        background-position: 56px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .batterie-remplissage.en-charge::after {
        animation: none;
    }
}

.metriques {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.metriques div {
    min-width: 0;
    padding: 14px;
    background: var(--fond-soft);
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.metriques dt {
    margin-bottom: 6px;
    color: var(--texte-discret);
    font-size: 0.82rem;
    font-weight: 700;
}

.metriques dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 1.1rem;
    font-weight: 750;
}

.autonomie-max {
    font-weight: 400;
    color: var(--texte-discret);
}

.icone-borne,
.icone-compteur,
.icone-batterie,
.icone-horloge,
.icone-conso {
    vertical-align: -3px;
    margin-right: 4px;
    color: var(--accent);
}

.icone-froid,
.icone-chaud {
    vertical-align: -3px;
    flex-shrink: 0;
}

.icone-froid {
    color: #2f80ed;
    margin-right: 6px;
}

.icone-chaud {
    color: #e2574c;
    margin-left: 6px;
}

.reglage-temperature {
    margin-bottom: 12px;
}

.reglage-temperature-controle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.bouton-temp {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--bordure, #d0d5dd);
    background: var(--fond-soft, #f5f5f5);
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    color: var(--accent);
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}

.bouton-temp:hover:not(:disabled) {
    background: var(--accent-pale, #e2f3ec);
    border-color: var(--accent);
}

.bouton-temp:active:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(1px);
}

.bouton-temp:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.bouton-temp:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.champ-temp {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    height: 40px;
    border: 1px solid var(--bordure, #d0d5dd);
    border-radius: 8px;
    background: var(--fond, #fff);
    overflow: hidden;
}

.champ-temp-unite {
    flex: 0 0 auto;
    padding: 0 10px 0 6px;
    color: var(--texte-discret);
    font-weight: 600;
}

/* Espace fantôme à gauche, de même largeur que le "°C" de droite, pour centrer le nombre. */
.champ-temp-unite--fantome {
    visibility: hidden;
}

.champ-temp-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    font-weight: 750;
    font-size: 1.05rem;
    color: inherit;
    -moz-appearance: textfield;
}

.champ-temp-input::-webkit-outer-spin-button,
.champ-temp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.titre-vehicule {
    margin: 0 0 2px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 750;
    color: var(--texte-fort, inherit);
}

.sous-titre-maj {
    margin: 0 0 12px;
    text-align: left;
    font-size: 0.78rem;
    color: var(--texte-discret);
}

.photo-vehicule {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 10px;
}

.metriques-verticales {
    grid-template-columns: 1fr;
}

.pied-panneau {
    margin-top: 18px;
    color: var(--texte-discret);
    font-size: 0.9rem;
}

.groupe-commandes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    color: var(--texte);
    text-decoration: none;
    background: #eef4f1;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    line-height: 1.1;
    transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.bouton:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--ombre-legere);
}

.bouton:focus-visible {
    outline: 3px solid rgba(44, 95, 158, 0.28);
    outline-offset: 2px;
}

.bouton:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.bouton-principal {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.bouton-principal:hover:not(:disabled) {
    background: var(--accent-fonce);
}

.bouton-secondaire {
    background: #ffffff;
    border-color: var(--bordure);
}

.bouton-secondaire:hover:not(:disabled) {
    border-color: var(--bordure-forte);
}

.bouton-danger {
    color: #ffffff;
    background: var(--danger);
}

.bouton-progression-charge {
    position: relative;
    overflow: hidden;
    color: #ffffff;
    background: var(--accent);
    border-color: var(--danger);
    isolation: isolate;
}

.bouton-progression-charge:disabled {
    opacity: 1;
}

.bouton-progression-charge::before {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    width: var(--progression-charge, 0%);
    content: "";
    background: var(--danger);
    transition: width 250ms linear;
}

.bouton-progression-charge span {
    position: relative;
    z-index: 1;
}

.bouton-compact {
    width: 42px;
    padding: 0;
}

.bouton-table {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 0.86rem;
    font-weight: 750;
}

.pleine-largeur {
    width: 100%;
}

.bloc-seuil-charge {
    margin-bottom: 16px;
}

.bloc-clim {
    padding-top: 16px;
    border-top: 1px solid var(--bordure);
}

.clim-message {
    margin: 12px 0 0;
    font-size: 0.9rem;
}

/* Message d'etape de la sequence de demarrage, sous le bouton de charge. */
.message-etape-charge {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent-fonce);
    background: var(--accent-pale);
    border: 1px solid #a9dcca;
}

/* Variante barre de progression : la bulle se remplit sur la duree du delai de l'etape. */
.message-etape-charge.avec-barre {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.message-etape-charge.avec-barre::before {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    width: var(--progression-etape, 0%);
    content: "";
    background: #a9dcca;
    transition: width 950ms linear;
}

.message-etape-charge span {
    position: relative;
    z-index: 1;
}

/* Bouton pre-conditionnement en cours : barre de progression sur ~10 min (cf. bouton de charge). */
.bouton-progression-clim {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent-fonce);
}

.bouton-progression-clim:disabled {
    opacity: 1;
}

.bouton-progression-clim::before {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    width: var(--progression-clim, 0%);
    content: "";
    background: var(--accent-fonce);
    transition: width 250ms linear;
}

.bouton-progression-clim span {
    position: relative;
    z-index: 1;
}

.bloc-seuil-charge label,
.bloc-clim label,
.bloc-label {
    display: block;
    margin-bottom: 10px;
    color: var(--texte-discret);
    font-size: 0.9rem;
    font-weight: 800;
}

/* Le label "Localisation" partage la ligne avec ses boutons : pas de marge basse. */
.panneau-localisation .ligne-titre .bloc-label {
    margin-bottom: 0;
}

.controle-reglage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.controle-reglage input {
    width: 100%;
    accent-color: var(--accent);
}

.controle-reglage output {
    font-weight: 850;
    text-align: right;
}

.alerte {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    color: #7d2020;
    background: var(--danger-pale);
    border: 1px solid #efb7b7;
    border-radius: 8px;
}

.alerte span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.vue-parametres {
    width: min(960px, 100%);
    margin-inline: auto;
}

.login-panneau {
    width: min(420px, 100%);
}

.login-panneau h1 {
    margin-bottom: 18px;
}

.login-panneau h2 {
    margin-bottom: 18px;
}

.login-panneau label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--texte-discret);
    font-size: 0.9rem;
    font-weight: 800;
}

.login-panneau input,
.login-panneau select {
    width: 100%;
    height: 44px;
    padding: 9px 12px;
    color: var(--texte);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-weight: 650;
}

.login-panneau small {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--texte-discret);
}

/* Inscription : indicateur d'étape, sous-titre de section, actions et lien de bascule login/inscription. */
.inscription-etapes {
    margin: -6px 0 16px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--info);
}

.inscription-section {
    margin: 6px 0 12px;
    padding-top: 12px;
    border-top: 1px solid var(--bordure);
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--texte-discret);
}

.inscription-actions {
    display: flex;
    gap: 12px;
}

.inscription-actions .bouton {
    flex: 1;
}

.inscription-lien-simule {
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--fond-soft);
    border: 1px dashed var(--bordure-forte);
    border-radius: 8px;
}

.inscription-lien-simule .inscription-section {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
}

.inscription-lien-simule a.bouton {
    margin-top: 8px;
    text-decoration: none;
}

.lien-inscription {
    margin: 18px 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--texte-discret);
}

.lien-bouton {
    padding: 0;
    border: 0;
    background: none;
    color: var(--info);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: underline;
}

.formulaire-parametres {
    box-shadow: var(--ombre);
}

.interrupteur {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    min-height: 72px;
    padding: 14px 16px;
    background: var(--fond-soft);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
}

.interrupteur input {
    width: 44px;
    height: 24px;
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.interrupteur span {
    display: grid;
    gap: 3px;
}

.interrupteur small {
    color: var(--texte-discret);
    line-height: 1.35;
}

.grille-formulaire {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    align-items: start;
    gap: 16px;
}

/* Paire de champs horaires (heure de début / fin) : toujours côte à côte, sur toute la largeur. */
.paire-heures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    grid-column: 1 / -1;
}

.grille-formulaire label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: var(--texte-discret);
    font-size: 0.9rem;
    font-weight: 800;
}

.grille-formulaire input,
.grille-formulaire select {
    width: 100%;
    height: 44px;
    padding: 9px 12px;
    color: var(--texte);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-weight: 650;
}

.grille-formulaire input:focus,
.grille-formulaire select:focus,
.login-panneau input:focus,
.formulaire-mot-de-passe input:focus {
    outline: 3px solid rgba(44, 95, 158, 0.18);
    border-color: var(--info);
}

.actions-formulaire {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.actions-formulaire .bouton {
    min-width: 132px;
}

.bloc-redemarrage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--bordure);
}

.bloc-redemarrage p:last-child {
    margin: 6px 0 0;
    color: var(--texte-discret);
    line-height: 1.4;
}

.bloc-redemarrage .bouton {
    flex: 0 0 auto;
}

.message-succes,
.message-erreur,
.message-info {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 750;
}

.message-succes {
    color: var(--accent-fonce);
    background: var(--accent-pale);
    border: 1px solid #a9dcca;
}

.message-erreur {
    color: #7d2020;
    background: var(--danger-pale);
    border: 1px solid #efb7b7;
}

.message-info {
    color: #214f87;
    background: #e5f0fb;
    border: 1px solid #b9d4f1;
}

.changement-mdp {
    width: min(520px, 100%);
    margin: 0;
}

.changement-mdp h1 {
    margin-bottom: 6px;
}

.bloc-auth {
    margin: 24px 0 16px;
    padding-top: 18px;
    border-top: 1px solid var(--bordure);
}

.bloc-auth h2 {
    margin-bottom: 10px;
}

.bloc-auth p:last-child {
    margin: 0;
    color: var(--texte-discret);
    line-height: 1.45;
}

.formulaire-mot-de-passe {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0 0 12px;
}

.formulaire-mot-de-passe label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: var(--texte-discret);
    font-size: 0.9rem;
    font-weight: 800;
}

.formulaire-mot-de-passe input {
    width: 100%;
    height: 44px;
    padding: 9px 12px;
    color: var(--texte);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-weight: 650;
}

.case-simple {
    display: flex !important;
    grid-column: 1 / -1;
    align-items: center;
    gap: 10px !important;
}

.case-simple input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.page-utilisateurs {
    width: min(1100px, 100%);
}

.page-vehicules {
    width: min(1120px, 100%);
}

.barre-page {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.grille-vehicules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.carte-vehicule {
    display: grid;
    grid-template-rows: 170px 1fr auto;
    gap: 16px;
}

.carte-vehicule.actif {
    border-color: #88cdb6;
    box-shadow: 0 12px 32px rgba(20, 122, 88, 0.14);
}

.carte-vehicule img {
    width: 100%;
    height: 170px;
    object-fit: contain;
    background: var(--fond-soft);
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.contenu-vehicule {
    min-width: 0;
}

.metriques-vehicule {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Wallbox modale ─────────────────────────────────────────────────── */

/* Badge statut wallbox */
.badge-wb {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

.statut-wb-off {
    background: var(--fond-soft);
    color: var(--texte-secondaire);
}

.statut-wb-attente {
    background: #fff3cd;
    color: #7a5c00;
}

.statut-wb-ok {
    background: #d1fae5;
    color: #065f46;
}

.statut-wb-hs {
    background: #fde2e1;
    color: #9b1c1c;
}

.wb-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--texte-secondaire);
}

.wb-input-mono {
    font-family: monospace;
    font-size: 0.8rem;
}

.wb-lien {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--couleur-principale, #147a58);
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wb-lien:hover {
    opacity: 0.75;
}

.wb-lien:disabled {
    opacity: 0.4;
    cursor: default;
}

.wb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.wb-actions-droite {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Barre d'actions du bas (wallbox) : espace réparti entre les boutons, sur une seule ligne. */
.wb-actions-bas {
    flex-wrap: nowrap;
    justify-content: space-evenly;
}

.wb-actions-bas .bouton {
    white-space: nowrap;
}

/* Toggle pilotage */
.wb-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--fond-soft);
    border-radius: 8px;
    flex-wrap: wrap;
}

.wb-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

/* Notes et feedback */
.wb-note {
    font-size: 0.78rem;
    color: var(--texte-secondaire);
    margin: 0;
    line-height: 1.4;
}

.wb-note-info {
    padding: 8px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: #7a5c00;
}

.wb-feedback {
    margin: 0;
    font-size: 0.82rem;
}

.metriques-vehicule dd {
    font-size: 0.98rem;
}

.panneau-vide {
    color: var(--texte-discret);
    font-weight: 750;
}

.page-evenements {
    width: min(1120px, 100%);
}

.page-appels-renault {
    width: min(1120px, 100%);
}

.selection-vehicule-technique {
    display: grid;
    gap: 6px;
    min-width: min(320px, 100%);
    color: var(--texte-discret);
    font-size: 0.9rem;
    font-weight: 800;
}

.selection-vehicule-technique select {
    width: 100%;
    height: 42px;
    padding: 8px 11px;
    color: var(--texte);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-weight: 700;
}

.liste-appels-renault {
    display: grid;
    gap: 20px;
}

.groupe-appels-renault {
    display: grid;
    gap: 12px;
}

.groupe-appels-renault h3 {
    color: var(--texte-discret);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.appel-renault {
    display: grid;
    gap: 14px;
}

.appel-renault.commande {
    border-color: #e2b5b5;
}

.ligne-appel-renault {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 16px;
}

.titre-appel-renault {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.titre-appel-renault h4 {
    margin: 0;
    font-size: 1.02rem;
}

.description-appel-renault,
.retour-appel-renault {
    margin: 0 0 8px;
    color: var(--texte-discret);
    line-height: 1.45;
}

.note-support-renault {
    margin: 8px 0 0;
    color: var(--texte-discret);
    font-size: 0.88rem;
    font-weight: 750;
    line-height: 1.4;
}

.chemin-appel-renault {
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 7px 9px;
    overflow-wrap: anywhere;
    color: #234437;
    background: var(--fond-soft);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.4;
}

.champs-appel-renault {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.champs-appel-renault label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--texte-discret);
    font-size: 0.88rem;
    font-weight: 800;
}

.champs-appel-renault input,
.champs-appel-renault textarea {
    width: 100%;
    padding: 9px 11px;
    color: var(--texte);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-weight: 650;
}

.champs-appel-renault textarea,
.reponse-renault {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.champs-appel-renault textarea {
    min-height: 118px;
    resize: vertical;
}

.champs-appel-renault small {
    color: var(--texte-discret);
    font-weight: 650;
    line-height: 1.35;
}

.reponse-renault {
    max-height: 520px;
    margin: 0;
    padding: 14px;
    overflow: auto;
    color: #0d2a1f;
    background: #f3f7f5;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.45;
}

.badge-danger {
    color: #7d2020;
    background: var(--danger-pale);
    border-color: #efb7b7;
}

.badge-support.support-oui {
    color: var(--accent-fonce);
    background: var(--accent-pale);
    border-color: #a9dcca;
}

.badge-support.support-non {
    color: #7d2020;
    background: var(--danger-pale);
    border-color: #efb7b7;
}

.badge-support.support-partiel {
    color: #6d5815;
    background: #fff6cf;
    border-color: #eadb9c;
}

.badge-support.support-accepte_non_confirme {
    color: #7a4a12;
    background: #fff1df;
    border-color: #efc28d;
}

.badge-support.support-a_verifier {
    color: #244a72;
    background: #eaf2fb;
    border-color: #c5d9ee;
}

.table-responsive {
    overflow-x: auto;
}

.table-users {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

.table-charges {
    min-width: 860px;
}

.vue-gestion-charges,
.panneau-gestion-charges {
    width: min(1120px, 100%);
}

.explication-charges {
    margin: 0 0 18px;
    padding: 13px 15px;
    color: #244a72;
    background: #eaf2fb;
    border: 1px solid #c5d9ee;
    border-radius: 8px;
    line-height: 1.45;
}

.explication-charges p {
    margin: 0;
}

.barre-gestion-charges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.selection-mode-charge {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    background: #e4ece8;
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.selection-mode-charge button {
    min-height: 38px;
    padding: 8px 13px;
    color: var(--texte-discret);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 850;
}

.selection-mode-charge button.actif {
    color: #ffffff;
    background: var(--accent);
}

.actions-gestion-charges {
    display: flex;
    gap: 10px;
}

.table-programmes-charge {
    min-width: 1040px;
}

.ligne-programme-voiture td {
    background: #f6fbff;
}

.ligne-programme-app td {
    background: #fffdf5;
}

.ligne-desactivee td {
    color: #7c8983;
    background: #f1f5f3;
}

.jours-programme {
    display: inline-flex;
    gap: 5px;
}

.jours-programme span {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    color: #95a19c;
    background: #edf2ef;
    border: 1px solid var(--bordure);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 850;
}

.jours-programme span.actif {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.badge-source {
    min-height: 26px;
    border-color: #eadb9c;
    background: #fff6cf;
    color: #6d5815;
}

.badge-source.voiture {
    color: #244a72;
    background: #eaf2fb;
    border-color: #c5d9ee;
}

.switch-compact {
    display: inline-flex;
    width: 42px;
    height: 24px;
    cursor: pointer;
}

.switch-compact input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-compact span {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    background: #cbd7d1;
    border-radius: 999px;
    transition: background-color 120ms ease;
}

.switch-compact span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(18, 28, 24, 0.22);
    transition: transform 120ms ease;
}

.switch-compact input:checked + span {
    background: var(--accent);
}

.switch-compact input:checked + span::after {
    transform: translateX(18px);
}

.switch-compact input:disabled + span {
    opacity: 0.45;
    cursor: not-allowed;
}

.erreur-programme {
    color: #7d2020;
    font-weight: 850;
}

.texte-discret,
.aide-action {
    color: var(--texte-discret);
}

.bouton-icone-table {
    width: 34px;
    padding: 0;
    font-size: 1.05rem;
}

.pied-gestion-charges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 18px;
}

.aide-action {
    margin: 0;
    font-weight: 750;
}

.modale-programme-charge {
    width: min(680px, 100%);
}

.ligne-titre-compacte {
    margin-bottom: 10px;
}

.bloc-jours-edition {
    margin-top: 18px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--fond-soft);
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.selecteur-duree-clim {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.selecteur-duree-clim button {
    flex: 1 1 0;
    min-width: 52px;
    padding: 7px 4px;
    color: var(--texte-discret);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.selecteur-duree-clim button:hover:not(.actif):not(:disabled) {
    background: var(--accent-pale, #e2f3ec);
    border-color: var(--accent);
    color: var(--accent-fonce, var(--accent));
}

.selecteur-duree-clim button.actif {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.selecteur-duree-clim button:disabled {
    cursor: default;
    opacity: 0.6;
}

.interrupteur-tous {
    margin: 0;
    color: var(--texte-discret);
    font-weight: 850;
}

.choix-jours {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choix-jours button {
    width: 42px;
    height: 42px;
    color: var(--texte-discret);
    background: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 900;
}

.choix-jours button.actif {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.table-evenements {
    min-width: 1180px;
    table-layout: fixed;
}

.table-evenements th:nth-child(1),
.table-evenements td:nth-child(1) {
    width: 112px;
}

.table-evenements th:nth-child(2),
.table-evenements td:nth-child(2) {
    width: 100px;
}

.table-evenements th:nth-child(3),
.table-evenements td:nth-child(3) {
    width: 78px;
}

.table-evenements th:nth-child(4),
.table-evenements td:nth-child(4) {
    width: 360px;
}

.table-evenements th:nth-child(5),
.table-evenements td:nth-child(5) {
    width: 74px;
}

.table-evenements th:nth-child(6),
.table-evenements td:nth-child(6) {
    width: 86px;
}

.table-evenements th:nth-child(7),
.table-evenements td:nth-child(7) {
    width: 370px;
}

.table-evenements td:nth-child(3),
.table-evenements td:nth-child(5),
.table-evenements td:nth-child(6) {
    white-space: nowrap;
}

.table-evenements td:nth-child(7) {
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.cellule-chemin {
    max-width: 360px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: normal;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.84rem !important;
}

.table-users th,
.table-users td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--bordure);
    text-align: left;
    vertical-align: middle;
}

.table-users th {
    color: var(--texte-discret);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-users td {
    font-size: 0.94rem;
    background: #ffffff;
}

.table-users tbody tr:hover td {
    background: #f8fbf9;
}

.table-vehicules-admin {
    min-width: 1040px;
}

.table-users td .sous-info {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--texte-discret);
}

.actions-cellule {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-role {
    min-height: 24px;
    padding: 4px 8px;
    font-size: 0.76rem;
}

.statut-session {
    color: var(--texte-discret);
    font-weight: 800;
    white-space: nowrap;
}

.statut-session.actif {
    color: var(--accent-fonce);
}

.actions-table {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    white-space: nowrap;
}

/* En vraie table (au-dessus du seuil de bascule en cartes, 460px), les actions doivent rester une
   cellule de tableau : un td en display:flex sort du modele table-cell et ne s'etire plus a la hauteur
   de la ligne (cellule plus courte que les voisines). On garde donc le td en table-cell et on aligne
   les boutons en inline. Ne concerne que les td (les cartes vehicule utilisent .actions-table sur un div). */
@media (min-width: 461px) {
    td.actions-table {
        display: table-cell;
        vertical-align: middle;
        text-align: right;
        white-space: nowrap;
    }

    td.actions-table .bouton {
        display: inline-flex;
        vertical-align: middle;
    }

    td.actions-table .bouton + .bouton {
        margin-left: 8px;
    }
}

.table-vide {
    padding: 24px !important;
    color: var(--texte-discret);
    text-align: center !important;
}

.modale-fond {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(18, 28, 24, 0.48);
    backdrop-filter: blur(2px);
}

.modale-utilisateur {
    width: min(720px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
}

.modale-utilisateur small {
    color: var(--texte-discret);
    font-weight: 650;
}

@media (max-width: 820px) {
    .application {
        width: 100%;
        padding: 0 0 20px;
    }

    /* Main pleine largeur : la barre de titre et les messages ont besoin d'un léger retrait. */
    .barre-page,
    .message-succes,
    .message-erreur,
    .message-info {
        margin-left: 5px;
        margin-right: 5px;
    }

    .grille-principale,
    .batterie,
    .grille-formulaire {
        grid-template-columns: 1fr;
    }

    /* Métriques sous la batterie : on garde 2 colonnes en mobile (demande produit),
       avec police + espacements réduits pour tenir sur un écran étroit. */
    .metriques {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .metriques div {
        padding: 10px;
    }

    .metriques dt {
        margin-bottom: 4px;
        font-size: 0.74rem;
    }

    .metriques dd {
        font-size: 0.95rem;
    }

    /* Barre : grille 4 colonnes × 2 rangées (façon lyracore, adaptée à joulette). */
    .entete {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        align-items: center;
        column-gap: 0.5rem;
        row-gap: 0.6rem;
        padding: 12px 16px;
    }

    .titre-app {
        grid-column: 1;
        grid-row: 1;
    }

    /* Les onglets desktop laissent place au menu hamburger. */
    .onglets {
        display: none;
    }

    .actions-entete {
        display: contents;
    }

    .barre-fixe-toggle {
        display: none;
    }

    .entete .session-utilisateur {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .config-conteneur {
        grid-column: 4;
        grid-row: 2;
        justify-self: end;
    }

    .session-boutons {
        display: contents;
    }

    .menu-mobile-bouton {
        display: inline-flex;
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .logout-bouton {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
    }

    .menu-mobile {
        display: grid;
        gap: 0.45rem;
        padding: 0.75rem 16px;
        background: var(--accent-fonce);
    }

    .menu-mobile button {
        width: 100%;
        padding: 11px 14px;
        color: #ffffff;
        text-align: left;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 8px;
        cursor: pointer;
        font-weight: 700;
    }

    .menu-mobile button.actif {
        color: var(--accent);
        background: #ffffff;
    }

    .actions-vue {
        justify-content: stretch;
    }

    .barre-gestion-charges,
    .barre-page,
    .bloc-redemarrage,
    .pied-gestion-charges {
        display: grid;
        justify-content: stretch;
    }

    .selection-mode-charge,
    .actions-gestion-charges {
        display: grid;
    }

    /* Historique — tri/filtre : on garde les pilules segmentées (pas d'empilement vertical).
       Les deux groupes restent en ligne et reviennent à la ligne si besoin. */
    .hist-sessions-entete {
        gap: 8px;
    }

    .hist-sessions-entete .selection-mode-charge {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    /* Boutons répartis équitablement sur toute la largeur du groupe. */
    .hist-sessions-entete .selection-mode-charge button {
        flex: 1 1 0;
        justify-content: center;
    }

    /* Tri : icônes seules. font-size:0 masque le libellé texte ; l'icône SVG (dimensions fixes)
       et la flèche de sens (.hist-tri-sens, taille réaffichée) restent visibles. */
    .hist-sessions-entete .selection-mode-charge[aria-label="Trier les sessions"] button {
        gap: 0;
        padding: 6px 10px;
        font-size: 0;
    }

    .hist-sessions-entete .selection-mode-charge[aria-label="Trier les sessions"] .hist-tri-sens {
        margin-left: 3px;
        font-size: 0.8rem;
    }

    /* Cartes de charge (blocs blancs de la liste) : coins droits en mobile.
       Sélecteur à 2 classes pour battre la règle de base (.carte-charge, déclarée plus bas). */
    .hist-sessions .carte-charge {
        border-radius: 0;
    }

    .panneau-etat {
        grid-row: auto;
    }

    .panneau {
        padding: 6px;
        border-radius: 0;
    }
}

@media (max-width: 460px) {
    .groupe-commandes,
    .formulaire-mot-de-passe {
        grid-template-columns: 1fr;
    }

    .actions-table {
        display: grid;
    }

    /* Pied de formulaire (popups : Annuler / Valider) : on garde les deux boutons
       sur la même ligne, à largeur égale, même sur petit écran. */
    .actions-formulaire {
        display: flex;
    }

    .actions-formulaire .bouton {
        flex: 1;
        min-width: 0;
    }

    /* Jours à cocher (popups programmes) : les 7 jours sur une seule ligne. */
    .choix-jours {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
    }

    .choix-jours button {
        width: 100%;
        height: 38px;
    }

    .table-responsive {
        overflow: visible;
    }

    .table-users {
        min-width: 0;
    }

    .table-users thead {
        display: none;
    }

    .table-users,
    .table-users tbody,
    .table-users tr,
    .table-users td {
        display: block;
        width: 100%;
    }

    .table-users tr {
        margin-bottom: 12px;
        padding: 12px;
        background: #f7faf8;
        border: 1px solid var(--bordure);
        border-radius: 8px;
    }

    .table-users td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 0;
        text-align: right;
    }

    .table-evenements {
        min-width: 0;
        table-layout: auto;
    }

    .table-evenements th,
    .table-evenements td {
        width: 100%;
    }

    .table-evenements td:nth-child(3),
    .table-evenements td:nth-child(5),
    .table-evenements td:nth-child(6) {
        white-space: normal;
    }

    .cellule-chemin {
        max-width: 100%;
        overflow: visible;
        overflow-wrap: anywhere;
        text-overflow: clip;
        white-space: normal;
    }

    .table-users td::before {
        content: attr(data-label);
        color: var(--texte-discret);
        font-weight: 800;
        text-align: left;
    }

    .actions-table {
        justify-content: stretch;
    }

    .actions-table::before {
        display: none;
    }

    /* Vignettes véhicules : boutons (Utiliser / Modifier / Wallbox / Supprimer) côte à côte par 2. */
    .carte-vehicule .actions-table {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .panneau {
        padding: 6px;
        border-radius: 0;
    }

    .ligne-titre {
        display: grid;
    }

    /* Programmes (popups) : "Jours actifs" à gauche et la case "Tous" à droite, même ligne. */
    .ligne-titre-compacte {
        display: flex;
        align-items: center;
    }

    /* Modales : titre à gauche, croix/badge en haut à droite sur la même ligne. */
    .modale-utilisateur .ligne-titre {
        display: flex;
        align-items: flex-start;
    }

    .badge {
        width: fit-content;
    }

    .badges-etat {
        justify-content: flex-start;
    }

    /* Bloc Position : on garde le titre à gauche et les boutons à droite sur la même ligne. */
    .panneau-localisation .ligne-titre {
        display: flex;
        align-items: center;
    }

    .panneau-localisation .badges-etat {
        justify-content: flex-end;
    }

    /* Homepage — Commandes : pas de titre "Commandes", et 2 cartes distinctes
       (niveau de charge / climatisation). Le panneau devient un simple conteneur. */
    .panneau-commandes {
        display: grid;
        gap: 10px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }

    .panneau-commandes .ligne-titre {
        display: none;
    }

    .panneau-commandes .bloc-commande {
        margin: 0;
        padding: 5px;
        background: var(--fond-panneau);
        border: 1px solid var(--bordure);
    }

    /* La clim est désormais sa propre carte : on retire le séparateur haut hérité. */
    .panneau-commandes .bloc-clim {
        padding-top: 12px;
        border-top: 0;
    }

    /* Pas de marge basse résiduelle en bas de la carte charge. */
    .panneau-commandes .bloc-commande-charge .groupe-commandes {
        margin-bottom: 0;
    }
}

/* ── Historique des charges : tableau de bord (nav année → mois, KPI, graphe, cartes) ── */
/* Bandeau haut du bloc : navigation (année/mois) à gauche + icône synchro à droite, même ligne. */
.hist-bandeau {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.hist-bandeau .hist-nav {
    flex: 1;
    margin-bottom: 0;
}

.hist-sync {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--texte);
    background: var(--fond-panneau);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    cursor: pointer;
}

.hist-sync:hover {
    border-color: var(--bordure-forte);
    background: var(--fond-soft);
}

.hist-sync:disabled {
    cursor: default;
}

.hist-sync.en-cours svg {
    animation: hist-sync-rotation 0.9s linear infinite;
}

@keyframes hist-sync-rotation {
    to {
        transform: rotate(360deg);
    }
}

.hist-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.hist-pas {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--texte);
    background: var(--fond-panneau);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.hist-pas:hover {
    border-color: var(--bordure-forte);
    background: var(--fond-soft);
}

.hist-annee {
    min-width: 82px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--texte);
}

.hist-fil {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--texte);
}

.hist-fil-lien {
    padding: 0;
    color: var(--accent-fonce);
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.hist-fil-sep {
    color: var(--texte-discret);
}

.hist-nav-espace {
    flex: 1;
}

.hist-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.hist-kpi {
    padding: 14px 16px;
    background: var(--fond-soft);
    border-radius: 8px;
}

.hist-kpi .kpi-l {
    margin: 0;
    font-size: 0.78rem;
    color: var(--texte-discret);
}

.hist-kpi .kpi-v {
    margin: 5px 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--texte);
}

.hist-kpi .kpi-u {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--texte-discret);
}

.hist-graphe-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.hist-graphe-entete > span {
    font-weight: 700;
    color: var(--texte);
}

.hist-graphe {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 148px;
}

.hist-col {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.hist-col-val {
    height: 14px;
    margin-bottom: 4px;
    font-size: 0.7rem;
    color: var(--texte-discret);
}

.hist-barre {
    width: 100%;
    min-width: 6px;
    background: var(--accent-pale);
    border-radius: 4px 4px 0 0;
    transition: background 0.15s ease;
}

.hist-barre.cliquable {
    cursor: pointer;
}

.hist-barre.cliquable:hover {
    background: var(--accent);
}

.hist-barre.selectionne {
    background: var(--accent-fonce);
}

.hist-barre.vide {
    background: var(--bordure);
    opacity: 0.55;
    cursor: default;
}

.hist-axe {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.hist-axe span {
    flex: 1;
    text-align: center;
    font-size: 0.7rem;
    color: var(--texte-discret);
}

.hist-aide-graphe {
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: var(--texte-discret);
    text-align: center;
}

.hist-sessions-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
    margin: 5px 0;
}

/* Chips de type + tri : version compacte du groupe segmenté (selection-mode-charge). */
.hist-sessions-entete .selection-mode-charge button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 11px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Chip de type actif : coloré selon le type (cohérent avec les badges badge-type-*). */
.hist-sessions-entete .selection-mode-charge button.actif.type-lente {
    background: #4a5568;
}

.hist-sessions-entete .selection-mode-charge button.actif.type-moyenne {
    background: #214f87;
}

.hist-sessions-entete .selection-mode-charge button.actif.type-rapide {
    background: #8a4b0a;
}

.hist-tri-sens {
    margin-left: 4px;
    font-weight: 850;
}

.hist-sessions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 5px;
}

.carte-charge {
    padding: 15px 17px;
    background: var(--fond-panneau);
    border: 1px solid var(--bordure);
    border-radius: 12px;
    box-shadow: var(--ombre-legere);
}

.carte-charge-entete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.carte-charge-date {
    margin: 0;
    font-size: 0.8rem;
    color: var(--texte-discret);
}

.carte-charge-heures {
    margin: 3px 0 0;
    font-size: 0.95rem;
    color: var(--texte);
}

.carte-charge-soc {
    white-space: nowrap;
    text-align: right;
}

.carte-charge-soc .soc-debut {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--texte-discret);
}

.carte-charge-soc .soc-fin {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--texte);
}

.carte-charge-soc .soc-fleche {
    color: var(--texte-discret);
}

.carte-charge-jauge {
    display: flex;
    height: 9px;
    margin: 12px 0 13px;
    overflow: hidden;
    background: var(--fond-soft);
    border-radius: 999px;
}

.jauge-depart {
    background: var(--info);
}

.jauge-gain {
    background: var(--accent);
}

.carte-charge-metriques {
    display: flex;
    align-items: center;
}

.carte-charge-metriques .metrique {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.metrique .m-v {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--texte);
}

.metrique .m-l {
    font-size: 0.7rem;
    color: var(--texte-discret);
}

.metrique-sep {
    align-self: stretch;
    width: 1px;
    min-height: 26px;
    background: var(--bordure);
}

.carte-charge-pied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.carte-charge-km {
    font-size: 0.82rem;
    color: var(--texte-discret);
    text-align: right;
}

@media (max-width: 820px) {
    .hist-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hist-nav {
        flex-wrap: wrap;
    }
}
