* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #F4F7F2 0%, #EAF1E6 100%);
    color: #2F3A32;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    min-height: 80px;
    padding: 14px 16px 10px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

header h1 {
    color: #5F7F5F;
    margin: 0;
    font-size: 32px;
    letter-spacing: 1px;
}

header p {
    color: #6F7D70;
    margin: 0;
    font-size: 14px;
}

#retour-accueil {
    color: #5F7F5F;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
}

main {
    width: min(97vw, 1450px);
    margin: 0 auto 20px auto;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.bloc {
    border: 1px solid #D9E4D2;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 28px rgba(80, 110, 80, 0.10);
    overflow: visible;
    min-width: 0;
}

h2 {
    text-align: center;
    color: #5F7F5F;
    margin: 0 0 10px 0;
    font-size: 17px;
}

p {
    margin: 6px 0;
    line-height: 1.2;
}

.ligne-formulaire {
    margin-bottom: 6px;
}

label {
    display: block;
    margin-bottom: 3px;
    color: #667568;
    font-size: 12px;
}

input,
select {
    width: 100%;
    background-color: #FAFCF8;
    color: #2F3A32;
    border: 1px solid #D9E4D2;
    border-radius: 8px;
    padding: 7px;
    outline: none;
    font-size: 13px;
}

input:focus,
select:focus {
    border-color: #7FA77B;
    box-shadow: 0 0 0 2px rgba(127, 167, 123, 0.18);
}

button {
    display: block;
    margin: 6px auto;
    background-color: #7FA77B;
    color: #FFFFFF;
    border: none;
    border-radius: 9px;
    padding: 7px 11px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 700;
    font-size: 13px;
}

button:hover {
    background-color: #6E966B;
    color: #FFFFFF;
    transform: translateY(-1px);
}

.bouton-danger {
    background-color: #C77C6B;
}

.bouton-danger:hover {
    background-color: #B86B5C;
}

.zone-resultat {
    border: 1px solid #D9E4D2;
    padding: 8px;
    margin-top: 8px;
    border-radius: 11px;
    background-color: #FAFCF8;
}

.valeur-principale {
    font-size: 24px;
    font-weight: bold;
    color: #5F7F5F;
    margin: 4px 0;
}

.message {
    color: #6E966B;
    text-align: center;
    font-weight: bold;
    min-height: 16px;
    font-size: 13px;
}

#affichage-resume,
#message-imc,
#message-objectif {
    color: #6F7D70;
    font-size: 13px;
}

#affichage-deficit-moyen,
#affichage-temps-estime {
    color: #5F7F5F;
    font-weight: bold;
}

#section-profil {
    grid-column: span 3;
}

#section-donnees-utilisateur {
    grid-column: span 3;
}

#section-imc {
    grid-column: span 3;
}

#section-objectif {
    grid-column: span 3;
}

#section-graphique-poids {
    grid-column: span 6;
}

#section-stats {
    grid-column: span 3;
}

#section-badges {
    grid-column: span 3;
}

#section-historique {
    grid-column: span 6;
    overflow-x: auto;
}

#canvas-graphique-poids {
    display: block;
    width: 100%;
    height: 340px;
    border: 1px solid #D9E4D2;
    background-color: #FAFCF8;
    border-radius: 11px;
}

.choix-mode {
    display: flex;
    gap: 6px;
}

.choix-mode button {
    flex: 1;
    font-size: 11px;
    padding: 7px 6px;
}

.bouton-actif {
    background-color: #5F7F5F;
    color: #FFFFFF;
}

#affichage-mode {
    text-align: center;
    color: #6F7D70;
    font-size: 13px;
}

.grille-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.stat {
    background-color: #FAFCF8;
    border: 1px solid #D9E4D2;
    border-radius: 11px;
    padding: 8px;
    min-height: 62px;
}

.stat p {
    color: #6F7D70;
    font-size: 11px;
    margin: 0 0 4px 0;
}

.stat strong {
    color: #5F7F5F;
    font-size: 16px;
}

#barre-progression {
    width: 100%;
    height: 10px;
    background-color: #DDE8D6;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

#remplissage-progression {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7FA77B, #A8C7A2);
    transition: 0.3s;
}

#affichage-progression {
    color: #6F7D70;
    text-align: center;
    font-size: 12px;
}

#liste-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    background-color: #FAFCF8;
    border: 1px solid #D9E4D2;
    color: #5F7F5F;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 12px;
}

.badge-verrouille {
    opacity: 0.35;
}

#table-historique {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 420px;
}

#table-historique th,
#table-historique td {
    border-bottom: 1px solid #D9E4D2;
    padding: 5px;
    text-align: center;
}

#table-historique th {
    color: #5F7F5F;
}

.bouton-tableau {
    margin: 0 auto;
    padding: 5px 7px;
    font-size: 11px;
    background-color: #C77C6B;
}

.bouton-tableau:hover {
    background-color: #B86B5C;
}

@media screen and (max-width: 1150px) {
    main {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    #section-profil,
    #section-imc,
    #section-donnees-utilisateur,
    #section-objectif,
    #section-stats,
    #section-badges {
        grid-column: span 3;
    }

    #section-graphique-poids,
    #section-historique {
        grid-column: span 6;
    }
}

@media screen and (max-width: 700px) {
    header {
        min-height: auto;
        padding: 18px 12px 12px 12px;
    }

    header h1 {
        font-size: 30px;
    }

    main {
        display: block;
        width: 94vw;
    }

    .bloc {
        margin-bottom: 12px;
        padding: 12px;
    }

    #canvas-graphique-poids {
        height: 300px;
    }

    .choix-mode,
    .grille-stats {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}