        :root { --p: #2b78e4; --s: #2c3e50; --bg: #f4f6f9; --accent: #e74c3c; --success: #16a34a; }
        * { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; }
        
        /* 1. Plein écran fixe et sans scroll global */
        html, body { 
            background: var(--bg); 
            margin: 0; 
            padding: 0; 
            height: 100dvh; 
            overflow: hidden; 
            color: #333; 
        }

        /* 2. Le container prend tout l'espace et structure les blocs en colonne */
        .container { 
            max-width: 1000px; 
            height: 100%; 
            margin: 0 auto; 
            background: #fff; 
            padding: 15px 20px; 
            display: flex; 
            flex-direction: column; 
            box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
        }

        /* En-tête fixe en haut */
        .app-header-top {
            flex-shrink: 0;
            display: flex;
            justify-content: space-between; /* Espace entre le titre à gauche et la période à droite (ou center si tu préfères tout regrouper) */
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 15px;
            border-bottom: 1px solid #e2e8f0;
            padding-bottom: 10px;
        }

        /* Formulaire flexible occupant l'espace intermédiaire */
        #form-main {
            display: flex;
            flex-direction: column;
            flex: 1;
            overflow: hidden;
            min-height: 0;
        }

        /* 3. Zone scrollable unique pour le contenu dynamique (Responsable + Enfants) */
        .scrollable-content {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding-right: 5px; /* Évite que la scrollbar touche le contenu */
            padding-bottom: 5px;
        }

        .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
        /*
        .grid-semaines {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 10px;
            justify-content: flex-start;
        }
        */
        .grid-semaines {
            display: grid;
            grid-template-columns: 1fr; /* Sur mobile : 1 colonne pleine largeur */
            gap: 10px;
        }

        /* Sur écran plus large (PC), tu peux repasser en multi-colonnes si tu le souhaites */
        @media (min-width: 768px) {
            .grid-semaines {
                grid-template-columns: repeat(4, 1fr); /* Par exemple 2 colonnes sur PC */
            }
        }
        /* Style par défaut pour la première carte (ex: blanc ou gris très très clair) */
        .card-enfant { 
            border: 2px solid #e2e8f0; 
            border-radius: 8px; 
            margin-bottom: 20px; 
            padding: 15px; 
            background: #fffcfb; 
            transition: background-color 0.2s ease;
        }

        /* Style alterné pour une meilleure distinction (ex: un gris/bleu très léger) */
        .card-enfant.card-alt { 
            background-color: #f8fafc; 
            border-color: #cbd5e1;
        }
        
        .card-semaine {
            border: 2px solid #cbd5e1;
            border-radius: 8px;
            padding: 10px;
            min-width: 210px;
            background: #ffffff;
            cursor: pointer;
            transition: all 0.2s ease-in-out;
            text-align: center;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }
        .card-semaine:hover {
            transform: translateY(-3px);
            border-color: var(--p);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .card-semaine.selected {
            border-color: var(--success);
            background-color: #f0fdf4;
        }
        .card-header { font-weight: bold; font-size: 1.05em; color: var(--s); margin-bottom: 5px; }
        .card-status {
            margin-top: 10px;
            font-size: 0.85em;
            font-weight: 600;
            color: var(--p);
            background: #f0f9ff;
            padding: 6px;
            border-radius: 4px;
            min-height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .card-semaine.selected .card-status { color: var(--success); background: #dcfce7; }

        dialog#modalWeekChoice {
            border: none;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            max-width: 520px;
            width: 95%;
        }
        dialog::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); }
        .opt-group { margin: 10px 0; padding: 10px; border-radius: 6px; background: #f8fafc; border: 1px solid #e2e8f0; transition: opacity 0.2s; }
        .opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
        .opt-row-left { display: flex; align-items: center; gap: 8px; flex: 1; }
        .opt-group.disabled { opacity: 0.4; cursor: not-allowed; }
        .opt-select { padding: 4px 8px; border-radius: 4px; border: 1px solid #cbd5e1; background: #fff; font-size: 0.9em; flex: 1; max-width: 220px; }
        .single-pole-text { font-size: 0.9em; color: #475569; font-weight: 500; }
        
        /* 4. Barre fixe en bas (ne bouge pas lors du scroll) */
        .sticky-bar { 
            flex-shrink: 0;
            background: #fff; 
            border: 2px solid var(--p); 
            border-radius: 8px; 
            padding: 12px 15px; 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            flex-wrap: wrap; 
            gap: 10px; 
            box-shadow: 0 -4px 12px rgba(0,0,0,0.08); 
            margin-top: 5px;
        }
        
        .btn { padding: 10px 18px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
        .btn-p { background: var(--p); color: #fff; }
        .btn-ok { background: #2ecc71; color: #fff; font-size: 1.1em; }
        .btn-del { background: var(--accent); color: #fff; padding: 4px 8px; font-size: 0.8em; }
        .btn-sec { background: #e2e8f0; color: #475569; }
        .btn-third { background: #6099e3; color: #e3e5e9; }
        .modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 100; }
        .modal-bg.active { display: flex; }
        .modal { background: #fff; padding: 20px; border-radius: 8px; width: 90%; max-width: 400px; }
        .alert-info { background: #ebf8ff; border-left: 4px solid var(--p); padding: 15px; margin-bottom: 20px; }
        .alert-warning { background: #fffaf0; border-left: 4px solid #dd6b20; padding: 15px; margin-bottom: 20px; }
        .info-age { font-size: 0.85em; color: #4a5568; margin-top: 2px; }
        label { font-size: 0.85em;}
        .d-none { display: none !important; }

        /* Conteneur de la barre d'onglets */
        .tabs-enfants-bar {
            display: flex;
            gap: 6px;
            overflow-x: auto;
            padding: 0 4px 4px 4px;
            margin-bottom: 0; /* Plus de marge en bas pour coller au panneau */
            scrollbar-width: thin;
            position: relative;
            z-index: 2; /* S'assure que les onglets passent au-dessus */
        }

        /* Style de base des onglets (inactifs) */
        .tab-btn {
            background: #e2e8f0;
            border: 1px solid #cbd5e1;
            border-bottom: none; /* Pas de bordure en bas */
            color: #64748b;
            padding: 8px 16px;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            font-size: 0.9em;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.15s ease;
            position: relative;
            top: 2px; /* Léger décalage vers le bas pour l'effet empilé */
        }

        /* Style de l'onglet actif (en surimpression) */
        .tab-btn.active {
            background: #ffffff; /* Même fond que la carte de l'enfant */
            color: var(--p, #2563eb);
            border-color: #cbd5e1;
            border-bottom: 2px solid #ffffff; /* Fusionne visuellement avec la carte */
            font-weight: 700;
            box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.04); /* Ombre portée vers le haut */
            z-index: 3;
        }

        /* Style du panneau de l'enfant qui reçoit l'onglet */
        .child-panel {
            display: none;
            background: #ffffff;
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            border-top-left-radius: 0; /* Angle carré en haut à gauche pour fusionner avec le premier onglet si besoin */
            padding: 15px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            position: relative;
            z-index: 1;
        }

        .child-panel.active {
            display: block;
        }
        
        /* Par défaut sur PC : on affiche le texte long, on cache le court */
        .d-inline-mobile { display: none; }


        /* --- Style de base (Desktop / Tablettes) --- */
#bar-step-2 {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

#bar-step-2-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#container-total {
    text-align: right;
}

#label-total {
    font-size: 0.75em;
    color: #4a5568;
    display: block;
    line-height: 1;
}

#txt-total {
    font-size: 1.3em;
    color: var(--accent);
}

#btn-valider {
    padding: 8px 14px;
    font-size: 0.9em;
}


/* --- Mode Smartphone (@media max-width: 480px) --- */
@media (max-width: 480px) {
    .sticky-bar {
      padding: 4px 6px;  
    }
    #bar-step-2 {
        gap: 4px;
    }

    #bar-step-2-right {
        gap: 6px;
    }

    /* Réduction du texte du total */
    #label-total {
        font-size: 0.6em;
    }

    #txt-total {
        font-size: 1.05em;
    }

    /* Bouton commentaire compact (icône seule) */
    #btn-comment-trigger {
        padding: 6px 8px;
        font-size: 0.6em;
    }

    /* Bouton Retour plus compact sur mobile */
    #btn-retour {
        padding: 6px 8px;
        font-size: 0.8em;
    }

    /* Le bouton valider reste inchangé ou garde sa taille standard */
    #btn-valider {
        /* On ne touche pas à ses dimensions pour qu'il reste bien visible et cliquable */
        padding: 8px 12px;
        font-size: 0.9em;
    }
}


        /* Sur mobile (écrans étroits) : on inverse */
        @media (max-width: 480px) {
            .d-none-mobile { display: none; }
            .d-inline-mobile { display: inline; }
        }

        /* Conteneur global des toasts (fixé en bas à droite de l'écran) */
        #toast-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            transform: none; /* On retire le centrage horizontal */
            z-index: 99999 !important; /* Priorité maximale au-dessus des modales */
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none; /* Laisse passer les clics à travers le conteneur vide */
            width: 90%;
            max-width: 400px;
        }

        /* Si tu souhaites que les toasts individuels s'alignent bien à droite à l'intérieur du conteneur */
        .notify-toast, #toast-container > div {
            margin-left: auto;
        }
        
        /* Style d'un toast individuel */
        .toast-notification {
            background: #1e293b; /* Fond sombre élégant */
            color: #ffffff;
            padding: 12px 16px;
            border-radius: 8px;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
            font-size: 0.9em;
            text-align: center;
            pointer-events: auto;
            opacity: 0;
            transition: opacity 0.3s ease, transform 0.3s ease;
            transform: translateY(20px);
        }

        .toast-notification.show {
            opacity: 1;
            transform: translateY(0);
        }

        /* Variantes de couleurs optionnelles */
        .toast-notification.error {
            background: #dc2626; /* Rouge pour les erreurs */
        }
        .toast-notification.success {
            background: #16a34a; /* Vert pour les succès */
        }

        .app-header-top.dev-mode {
           background-color: #fef2f2 !important; /* Fond rouge très clair d'avertissement */
            border-bottom: 3px solid #dc2626 !important; /* Bordure rouge vive */
        }

        .nom-loisir {
            font-weight: 500;
        }

        .txt-age {
            display: inline-block; background-color: #e2e8f0; color: #334155; font-size: 0.75em; font-weight: bold; padding: 2px 8px; border-radius: 12px; border: 1px solid #cbd5e1;
        }

        @media print {
            /* Définition du format de la page et des marges */
            @page {
                size: A4 portrait; /* Ou 'landscape' si tu veux du format paysage */
                margin: 10mm;      /* Ajuste les marges selon tes besoins (ex: 10mm, 20mm, etc.) */
            }

            /* Annule le scroll et les limites de hauteur pour afficher tout le contenu */
            .scrollable-content, 
            .card-enfant {
                max-height: none !important;
                overflow: visible !important;
                height: auto !important;
                display: block !important;
            }

            .container {
                height: auto;
                width: 100% !important;
                max-width: none !important;
            }

            /* Optionnel : cacher les éléments interactifs inutiles sur le papier (boutons, barres d'onglets, etc.) */
            .btn, 
            .tabs-enfants-bar, 
            .sticky-bar, 
            button {
                display: none !important;
            }

            .sticky-bar {
                display: block !important;
                position: static !important;
                width: 100% !important;
                background-color: #ffffff !important;
                box-shadow: none !important;
                margin-top: 20px !important;
                page-break-inside: avoid;
            }

            /* S'assurer que le fond et les couleurs passent bien à l'impression */
            body {
                background-color: white !important;
                color: black !important;
                height: auto;
                overflow-y: auto;
                zoom: 80%;
            }

            .grid-semaines {
                display: grid;
                /* Crée autant de colonnes égales qu'il y a de cartes, avec une largeur minimale de sécurité */
                grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
                gap: 12px; /* Espacement propre entre les cartes */
                width: 100%;
            }

            /* S'assure que chaque carte prend bien toute la largeur de sa colonne attribuée */
            .grid-semaines > div, 
            .card-semaine {
                width: 100%;
                box-sizing: border-box;
            }
        }

        .titre-text {
                margin:0; color:var(--s); font-size: 0.95em; white-space: nowrap; padding-bottom: 3px;
            }

        .titre-section {
            position: sticky; top: 0; background: #ffffff; z-index: 5; display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; gap: 8px; border-bottom: 1px solid #e2e8f0; margin-bottom: 10px; padding: 5px 0px;
        }

        .infos-enfant {
            display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:8px; flex-wrap:wrap;
        }

        .dev-info-txt {
            background-color: #dc2626; color: #ffffff; font-weight: bold; font-size: 0.8em; padding: 4px 10px; border-radius: 4px; letter-spacing: 0.5px;
        }

        #banniere-confirmation {
            display: none; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 6px 6px; border-radius: 8px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(22, 163, 74, 0.05);
        }

        .tooltip-container { 
    position: relative; 
    display: inline-block; 
    cursor: pointer; 
    color: #2563eb; 
    text-decoration: underline; 
}
.tooltip-container .tooltip-text {
    display: none; 
    width: 250px; 
    background-color: #ffffff; 
    color: #0f172a; 
    text-align: left;
    border-radius: 6px; 
    padding: 10px; 
    position: absolute; 
    z-index: 100; 
    bottom: 125%; 
    left: 0;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); 
    border: 1px solid #cbd5e1; 
    font-size: 0.85em; 
    font-weight: normal;
}
/* S'affiche si on a la classe .visible (ajoutée par le clic sur mobile) */
.tooltip-container.visible .tooltip-text { 
    display: block; 
}
/* Garde aussi le survol classique pour les ordinateurs */
@media (hover: hover) {
    .tooltip-container:hover .tooltip-text { 
        display: block; 
    }
}

/* Style de l'overlay de la modale de commentaire */
#modal-commentaire.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75); /* Fond sombre semi-transparent */
    z-index: 9999;                      /* S'assure qu'elle passe au-dessus de tout */
    display: none;                      /* Cachée par défaut (le JS la passe en 'flex') */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Style de la boîte de contenu de la modale */
#modal-commentaire .modal-content {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s ease-in-out;
}

/* Petite animation d'apparition optionnelle */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

#panel-comm {
    background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 6px; padding: 12px; margin-top: 15px; border-top-left-radius:0px;
}
