:root {
    --font-main: 'Inter', -apple-system, sans-serif;
    --primary-rgb: 239, 68, 68;
    --accent-rgb: 16, 185, 129;
    --danger-rgb: 239, 68, 68;
    
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --glass-blur: 14px;
    --sidebar-color: rgba(15, 5, 7, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-main); }


body {
    min-height: 100vh;
    background: linear-gradient(135deg, #2b0c0d 0%, #4a151b 50%, #1a080a 100%);
    color: #fff;
    display: flex;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background-color: var(--sidebar-color);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--border-color);
    box-shadow: 5px 0px 15px var(--shadow-color);
    z-index: 100; /* Assure que le menu est au-dessus du contenu */
    /* AJOUT ESSENTIEL POUR LE FOOTER */
    display: flex;             /* Active Flexbox */
    flex-direction: column;    /* Empile les éléments verticalement */
    justify-content: space-between; /* Distribue l'espace (Header haut, Footer bas) */
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-accent-color);
}

.nav-links {
    list-style-type: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.nav-links li a:hover, .nav-links li a.active {
    background-color: var(--primary-accent-color);
    color: #fff;
}

.nav-links li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.sidebar-footer a {
    display: block;
    padding: 12px;
    background: var(--glass-bg);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-footer a:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 194, 203, 0.4);
}

.main-content { margin-left: 250px; flex: 1; padding: 30px; overflow-y: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; margin-bottom: 25px; }

.profil-selector-container { display: flex; align-items: center; gap: 12px; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.btn {
    padding: 10px 20px; border-radius: 8px; border: 1px solid transparent;
    cursor: pointer; font-weight: 600; transition: all 0.3s;
}
.btn--primary {
    background: rgba(var(--primary-rgb), 0.7);
    border-color: rgba(var(--primary-rgb), 0.9);
    color: #fff;
}
.btn--primary:hover {
    background: rgba(var(--primary-rgb), 1);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border);
    color: #fff;
}
.btn--danger { 
    background: rgba(220, 38, 38, 0.6); 
    color: #fff; 
    border: 1px solid rgba(220, 38, 38, 0.8); 
}
.btn--danger:hover {
    background: rgba(220, 38, 38, 0.9);
}

.btn-icon-danger {
    background: transparent;
    border: none;
    color: rgb(var(--danger-rgb));
    cursor: pointer;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: 0.2s;
}
.btn-icon-danger:hover {
    background: rgba(var(--danger-rgb), 0.2);
}

.form-input {
    background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff; padding: 8px 12px; border-radius: 8px; outline: none; font-size: 0.9rem;
}
.form-input:focus { border-color: rgb(var(--accent-rgb)); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4); }
.form-input::placeholder { color: rgba(255, 255, 255, 0.45); font-style: italic; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { padding: 20px; text-align: center; }
.stat-value { font-size: 2rem; font-weight: bold; color: rgb(var(--accent-rgb)); margin-top: 10px; }

.chart-container { padding: 25px; margin-bottom: 25px; }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.time-controls { display: flex; gap: 8px; }
.btn-time {
    background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-border);
    color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.btn-time.active { background: rgb(var(--primary-rgb)); }

.metrics-selector { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip {
    background: rgba(0, 0, 0, 0.3); padding: 6px 12px; border-radius: 20px;
    border: 1px solid var(--glass-border); font-size: 0.85rem; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
}
.chip input { cursor: pointer; }

.canvas-wrapper { position: relative; width: 100%; height: 380px; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.profile-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.profile-card-header h3 { color: rgb(var(--accent-rgb)); margin-bottom: 8px; }
.profile-card-info p { font-size: 0.9rem; color: #ccc; margin-bottom: 4px; }
.profile-card-actions { margin-top: 15px; display: flex; gap: 8px; justify-content: flex-end; }

.birthdate-split-row {
    display: grid;
    grid-template-columns: 80px 1fr 95px;
    gap: 8px;
}

.danger-zone {
    padding: 20px;
    border: 1px solid rgba(220, 38, 38, 0.4);
    background: rgba(220, 38, 38, 0.08);
}
.danger-zone h4 { color: rgb(var(--danger-rgb)); margin-bottom: 8px; }
.danger-zone p { font-size: 0.9rem; color: #ddd; margin-bottom: 14px; }

.app-view { display: none; }
.app-view.active { display: block; }

/* ==========================================================================
   MODAL ET GUIDE ANATOMIQUE TYPE VÊTEMENTS / TAILLES
   ========================================================================== */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); display: none; justify-content: center; align-items: center; z-index: 1000;
    padding: 16px;
}

.modal-content {
    width: 95%;
    max-width: 600px;
    max-height: 94vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-content.modal-measure-guide {
    max-width: 900px; /* Largeur optimale pour aérer les boîtes et la silhouette */
}

.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }

.modal-header { margin-bottom: 12px; }
.modal-header h3 { color: rgb(var(--primary-rgb)); font-size: 1.25rem; margin-bottom: 4px; }
.modal-hint { font-size: 0.84rem; color: #bbb; line-height: 1.4; }

.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-group label { font-size: 0.85rem; color: #ddd; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 1. Bandeau supérieur : Date / Poids / Hauteur */
.measure-top-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
}
.measure-field { display: flex; flex-direction: column; gap: 4px; }
.measure-field label { font-size: 0.82rem; color: #ddd; font-weight: 500; }
.date-input-wrap input { width: 100%; }

/* 2. Scène Morphologique : Grille 3 Colonnes parfaitement rythmée */
.anatomy-guide-stage {
    display: grid;
    grid-template-columns: 1fr 280px 1fr;
    gap: 12px;
    align-items: stretch;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px 10px;
}

.guide-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Espace équidistant entre les 5 cartes */
    gap: 14px;
}

.guide-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 64px; /* Hauteur fixe pour aligner parfaitement les départs des lignes SVG */
    justify-content: center;
    transition: 0.25s ease;
}
.guide-card:focus-within {
    border-color: rgb(var(--accent-rgb));
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25);
}

.guide-card label {
    font-size: 0.78rem;
    color: #ccc;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-unit .guide-input {
    width: 100%;
    padding-right: 32px;
    text-align: right;
    font-weight: 600;
}
.input-with-unit .unit {
    position: absolute;
    right: 10px;
    font-size: 0.75rem;
    color: #888;
    pointer-events: none;
}

/* Silhouette Vectorielle & Réticules */
.guide-figure-wrapper {
    position: relative;
    width: 100%;
    height: 390px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background: radial-gradient(circle at center, rgba(30, 10, 15, 0.6) 0%, rgba(15, 5, 8, 0.95) 100%);
}

.guide-img-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: 95%;
    max-width: 90%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.25));
}

.guide-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.guide-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Anneaux de mesure (Tape Rings) */
.tape-line {
    stroke: rgba(16, 185, 129, 0.8);
    stroke-width: 2;
    stroke-dasharray: 3, 3;
}

/* Trait d'épaule plein et très contrasté */
.tape-shoulder-bar {
    stroke: rgb(var(--accent-rgb));
    stroke-width: 2.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.9));
}

/* Anneaux de mensuration */
.tape-ring {
    fill: none;
    stroke: rgba(16, 185, 129, 0.85);
    stroke-width: 2;
    stroke-dasharray: 4, 3;
}

.tape-ring--glow {
    stroke: rgb(var(--accent-rgb));
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.85));
}

/* Lignes directrices */
.guide-polyline {
    fill: none;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 1.5;
    stroke-dasharray: 4, 4;
}

/* Pastilles lumineuses d'impact */
.guide-node {
    fill: rgb(var(--accent-rgb));
    stroke: #ffffff;
    stroke-width: 1.5;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 1));
}

/* ==========================================================================
   TABLEAUX HISTORIQUE
   ========================================================================== */
.table-container { padding: 15px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); text-align: left; }
.data-table th { color: #aaa; font-size: 0.85rem; }

/* Table Historique Complète Scrollable */
.table-container {
    width: 100%;
    overflow-x: auto;
    padding: 12px;
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table th {
    color: #fca5a5;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Toast Informatif Glassmorphism */
#health-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(20, 10, 15, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    font-size: 0.9rem;
    animation: toastSlideIn 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Style Date Input & Calendar Picker */
.form-input--date {
    color-scheme: dark;
    cursor: pointer;
}

/* Bouton Roue Crantée */
.chart-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon-config {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e5e7eb;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-config:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: #ef4444;
    color: #fff;
    transform: rotate(45deg);
}

/* Grille du Modal de Sélection des Métriques */
.metrics-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metrics-config-col h4 {
    font-size: 0.8rem;
    color: #fca5a5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.metric-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #e2e8f0;
    margin-bottom: 8px;
    cursor: pointer;
}

.metric-toggle input[type="checkbox"] {
    accent-color: #ef4444;
    cursor: pointer;
}

.metric-toggle .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Couleurs des pastilles */
.dot-poids { background: #ef4444; }
.dot-imc { background: #10b981; }
.dot-hauteur { background: #38bdf8; }
.dot-rth { background: #06b6d4; }
.dot-epaule { background: #a855f7; }
.dot-poitrine { background: #3b82f6; }
.dot-taille { background: #f59e0b; }
.dot-hanche { background: #ec4899; }
/* Pastilles Couleurs Gauche / Droit */
.dot-bras-g { background: #f43f5e; border: 1px dashed #fff; }
.dot-bras-d { background: #e11d48; }
.dot-cuisse-g { background: #a78bfa; border: 1px dashed #fff; }
.dot-cuisse-d { background: #7c3aed; }
.dot-mollet-g { background: #2dd4bf; border: 1px dashed #fff; }
.dot-mollet-d { background: #0d9488; }
.dot-bassin { background: #f472b6; }
/* Pastilles Indicateurs supplémentaires*/
.dot-bassin { background: #f472b6; }
.dot-img { background: #eab308; }
.dot-rts { background: #0ea5e9; }
.dot-rtb { background: #6366f1; }
.dot-diff { background: #f97316; }

/* Alignement Titre + Bouton Roue */
.chart-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-title-group h3 {
    font-size: 1.15rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bouton Roue Crantée */
.btn-icon-config {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: #eee;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-icon-config:hover {
    background: rgba(var(--primary-rgb), 0.35);
    border-color: rgba(var(--primary-rgb), 0.7);
    color: #fff;
    transform: rotate(45deg);
}

/* Alignement parfait de la barre de temps + reset zoom */
.time-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}


/* Badge Âge à côté du sélecteur */
.profil-age-pill {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Libellés et sous-titres des cartes KPI */
.stat-label {
    font-size: 0.82rem;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stat-sub {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 6px;
    font-weight: 500;
}

.stat-sub.positive { color: #34d399; }  /* Baisse de poids / Bon statut */
.stat-sub.warning { color: #fbbf24; }   /* Attention / Légère hausse */
.stat-sub.danger { color: #f87171; }    /* Alerte */

/* Carte de Synthèse Morphologique */
.summary-card {
    padding: 18px 24px;
    margin-bottom: 25px;
    border-left: 4px solid rgb(var(--accent-rgb));
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.summary-header h4 {
    font-size: 1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.summary-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.summary-badge.danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 0.78rem;
    color: #fca5a5;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-text {
    font-size: 0.88rem;
    color: #e2e8f0;
    line-height: 1.4;
}

/* ==========================================================================
   PANNEAU DÉROULANT NUTRITION & BMR
   ========================================================================== */
.nutrition-accordion {
    margin-bottom: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.nutrition-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.nutrition-accordion-header:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nutrition-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.nutrition-header-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-pill {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: #fdba74;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.toggle-icon {
    color: #bbb;
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.toggle-icon.open {
    transform: rotate(180deg);
}

/* Corps déroulant */
.nutrition-accordion-body {
    display: none;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nutrition-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.nutrition-metric-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.nm-label {
    font-size: 0.78rem;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nm-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f97316;
    margin: 6px 0;
}

.nm-sub {
    font-size: 0.75rem;
    color: #888;
}

.nutrition-section-title {
    font-size: 0.85rem;
    color: #ddd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grille Macronutriments */
.macros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.macro-card {
    border-radius: 10px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.macro-prot { border-left: 4px solid #ef4444; }
.macro-lip  { border-left: 4px solid #eab308; }
.macro-glu  { border-left: 4px solid #38bdf8; }

.macro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.macro-prot .macro-name { color: #fca5a5; }
.macro-lip  .macro-name { color: #fde047; }
.macro-glu  .macro-name { color: #7dd3fc; }

.macro-ratio {
    font-size: 0.75rem;
    color: #aaa;
}

.macro-grams {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 6px 0;
}

.macro-detail {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Encadré Conseil */
.nutrition-advice-box {
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.advice-text {
    font-size: 0.88rem;
    color: #fef08a;
    line-height: 1.45;
    margin: 0;
}

/* --- Style du Bouton Burger --- */
.mobile-menu-toggle {
    display: none !important; /* Caché sur PC */
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1002;
    
    /* Design Glassmorphism */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px; /* ou var(--radius-sm) selon ta charte */
    color: white; /* Icône blanche pour le contraste */
    
    width: 45px;
    height: 45px;
    display: flex; /* Centrage parfait de l'icône */
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

/* --- RESPONSIVE DESIGN MOBILE --- */
@media (max-width: 768px) {
    /* Afficher le bouton en Flex au lieu de Block pour le centrage */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Le menu lui-même */
    .sidebar {
        width: 280px; /* Un peu plus large pour respirer */
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Animation plus douce */
        z-index: 1001; /* Au dessus de tout */
        
        /* Renforcement du glassmorphism */
        background: rgba(20, 20, 35, 0.85); /* Plus sombre pour une bonne lisibilité */
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        
        padding-top: 60px; /* Laisse la place au bouton burger en haut */
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5); /* Ombre portée douce */
    }

    /* Aération des liens du menu */
    .nav-links li a {
        padding: 18px 25px; /* Plus d'espace tactile */
        font-size: 1.1rem;
        border-radius: 0 20px 20px 0; /* Arrondi d'un seul côté, très moderne */
        margin-right: 15px; /* Laisse de l'espace à droite */
    }

    /* L'Overlay sombre qui apparaît derrière le menu */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 1000; /* Juste en dessous de la sidebar (1001) */
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .menu-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Ajustement de l'espace principal */
    #main-content {
        margin-left: 0;
        padding: 70px 15px 20px 15px; /* Espace en haut pour ne pas cacher le titre sous le burger */
    }

    .page-content {
        padding: 15px;
    }

    .page-content h1 {
        font-size: 1.5rem;
    }

    /* Empiler les éléments qui étaient côte à côte (Flex/Grid) */
    .form-row, 
    .conges-layout {
        flex-direction: column;
        gap: 10px;
    }

    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    #nav-buttons {
        justify-content: space-between;
    }

    /* Laisser le calendrier et les tableaux déborder horizontalement au lieu de les écraser */
    #calendar-container,
    .detailed-analysis-container {
        overflow-x: auto;
        padding-bottom: 10px;
    }

        /* Boutons et formulaires : Pleine largeur et empilés */
    .form-actions {
        flex-direction: column;
        gap: 15px;
    }
    .form-actions button, 
    .button-group button {
        width: 100%;
        margin: 0;
        padding: 12px; /* Plus haut pour un meilleur confort tactile */
    }

    /* Formulaire des pauses multiples plus compact */
    .pause-row {
        flex-wrap: wrap; /* Laisse les champs d'heure passer à la ligne si besoin */
        justify-content: space-between;
    }
    .pause-row input[type="time"] {
        width: 45%; /* Les champs heure prennent presque la moitié de la ligne */
        flex: none;
    }

    /* Calendrier : optimisation de l'espace */
    .day {
        height: 60px; /* Réduit la hauteur sur mobile */
        padding: 2px;
    }
    .day-number {
        font-size: 0.8em; /* Chiffres plus petits */
    }
    .marker {
        height: 3px; /* Marqueurs d'absence plus fins */
    }

    /* Correction des Tooltips (Infobulles) des statistiques */
    .kpi .tooltip {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0;
        width: 90vw;
        max-width: 350px;
        z-index: 1000;
        box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    }
    /* Masquer la petite flèche de l'infobulle sur mobile */
    .kpi .tooltip::after {
        display: none; 
    }

        /* --- 1. OPTIMISATION GLOBALE DES CHAMPS --- */
    /* Taille 16px obligatoire pour empêcher l'iPhone de zoomer tout seul */
    input, select, textarea {
        font-size: 16px !important; 
        padding: 12px 15px; /* Zones de frappe plus grandes */
    }

    /* --- 2. GRILLES DES HORAIRES (Pointage & Congés) --- */
    /* On garde Arrivée/Départ et Début/Fin côte à côte, mais en forçant la largeur */
    .form-row {
        display: grid !important; /* On écrase le flex précédent */
        grid-template-columns: 1fr 1fr; /* 50% - 50% */
        gap: 15px;
    }

    /* --- 3. REFONTE DES PAUSES EN "MINI-CARTES" --- */
    /* Transforme la ligne de pause écrasée en une carte bien aérée */
    .pause-row {
        display: flex;
        flex-wrap: wrap;
        padding: 15px;
        margin-bottom: 15px;
        background-color: rgba(0, 0, 0, 0.2); /* Fond légèrement plus foncé */
        border-radius: 12px;
        gap: 10px;
    }
    
    /* Le titre "Pause 1" passe tout en haut de la carte */
    .pause-row .pause-number {
        width: 100%;
        margin-bottom: 5px;
        text-align: left;
        font-size: 1.1em;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 8px;
    }

    /* Les champs de saisie (Heure de début et Heure de fin) se partagent la largeur */
    .pause-row input[type="time"] {
        flex: 1; /* Prennent toute la place disponible */
        min-width: 40%;
    }

    /* Le bouton supprimer (Poubelle) passe tout en bas de la carte, en pleine largeur */
    .pause-row .btn-remove-pause {
        width: 100%;
        margin-top: 5px;
        padding: 12px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 8px;
    }

    /* --- 4. GROS BOUTONS D'ACTION EN BAS DE PAGE --- */
    .form-actions {
        display: flex;
        flex-direction: column; /* Empile les boutons "Enregistrer" et "Supprimer" */
        gap: 12px;
        margin-top: 30px;
    }

    .form-actions button,
    .btn-add-pause {
        width: 100%;
        padding: 15px; /* Très confortable pour le pouce */
        font-size: 1.1rem;
        font-weight: bold;
    }
    
    /* Bouton ajouter une pause un peu plus discret mais tout aussi large */
    .btn-add-pause {
        margin-top: 5px;
        margin-bottom: 20px;
    }

}
