@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Outfit:wght@300;400;600;800&display=swap');

:root {
    /* Nouvelle Palette Ultra-Premium Soft (Aurore / Océan) */
    --primary: #6366f1; /* Soft Indigo */
    --primary-light: #a5b4fc;
    --accent: #14b8a6; /* Teal vif */
    --accent-light: #5eead4;
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --button-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7); /* Stronger glassmorphism */
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', system-ui, sans-serif; }

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Lock viewport */
    position: fixed; /* Prevent bouncy scroll on iOS/Android */
}

body {
    background: #e2e8f0;
    /* Soft mesh gradient background */
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Simulate Phone Screen on Desktop */
#app-container {
    width: 100%;
    max-width: 414px;
    height: 100%;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Simulate Phone Screen on Desktop - Removed for True Desktop Mode */
@media (min-width: 500px) and (max-width: 1023px) {
    #app-container {
        height: 90vh;
        border-radius: 48px;
        border: 12px solid #0f172a;
        box-shadow: 0 40px 80px -20px rgba(0,0,0,0.8);
    }
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease-out forwards;
}

#app-dashboard {
    height: 100%;
    width: 100%;
    display: none;
    flex-direction: column;
}
#app-dashboard.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Onboarding - Design Neutre, Graphique & Premium */
#onboarding, #screen-onboarding { 
    background: #ffffff;
    background-image: 
        radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(20, 184, 166, 0.1) 0px, transparent 50%);
    justify-content: center; 
    padding: 3rem 2.5rem; 
}

.logo-area { text-align: center; margin-bottom: 3.5rem; display: flex; flex-direction: column; align-items: center;}
.app-logo-vector { 
    width: 86px; 
    height: 86px; 
    border-radius: 28px; 
    margin-bottom: 1.5rem; 
    background: var(--primary-gradient);
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.5); 
    color: white; 
    font-size: 2.5rem;
}
.logo-area h1 { 
    color: var(--text-main);
    font-size: 2.8rem; 
    letter-spacing: -1px; 
    font-weight: 800;
    margin-bottom: 0.2rem;
}
.logo-area p { 
    color: var(--accent); 
    font-size: 0.9rem; 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 2px;
}

.onboarding-content h2 { margin-bottom: 1.5rem; color: var(--text-main); font-size: 1.8rem; font-weight: 800;}

.options-grid { display: flex; flex-direction: column; gap: 1.5rem; }

.choice-btn {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 1.2rem;
    border-radius: 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.choice-btn .icon-bg {
    background: var(--button-gradient);
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px -5px rgba(168, 85, 247, 0.4);
}

.choice-btn .text-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.choice-btn i { 
    font-size: 1.4rem; 
    color: white;
}
.choice-btn span.title { font-weight: 800; color: var(--text-main); font-size: 1.2rem; }
.choice-btn span.desc { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.choice-btn:hover { 
    transform: translateY(-5px) scale(1.02); 
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-light);
    background: white;
}

/* Dashboard */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 2.5rem 1.5rem 1rem;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}
.user-profile { display: flex; align-items: center; gap: 12px; flex: 1;}
.avatar { width: 44px; height: 44px; border-radius: 50%; background-size: cover; border: 2px solid white; box-shadow: 0 4px 10px rgba(0,0,0, 0.08); flex-shrink: 0;}
.context-select {
    appearance: none;
    background: #f1f5f9;
    border: none;
    height: 44px;
    padding: 0 35px 0 20px;
    border-radius: 22px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230f172a%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 14px top 50%;
    background-size: 10px auto;
    font-family: 'Outfit';
    max-width: 200px;
}
.actions i { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--text-main); background: #f1f5f9; border-radius: 50%; cursor: pointer; transition: background 0.2s;}
.actions i:hover { background: #e2e8f0; }

.dashboard-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    gap: 1.8rem; 
    padding-bottom: 100px; 
}

/* Hero Card Shared/Separated */
.hero-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1.5rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}
.hero-card::after { pointer-events: none;
    content: ''; position: absolute; top: -50%; right: -20%; width: 250px; height: 250px;
    background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero-tag { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #a5b4fc; margin-bottom: 0.5rem; }
.hero-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 1.5rem; line-height: 1.3; }
.kids-avatars { display: flex; gap: -10px; margin-bottom: 1.5rem; }
.kids-avatars img { width: 40px; height: 40px; border-radius: 14px; border: 2px solid white; z-index: 1; box-shadow: 0 4px 6px rgba(0,0,0,0.1);}
.btn-primary { background: white; color: var(--primary); border: none; padding: 0.7rem 1.2rem; border-radius: 12px; font-weight: 800; font-size: 0.85rem; cursor: pointer; position: relative; z-index: 2; box-shadow: 0 4px 10px rgba(0,0,0,0.1); width: 100%;}

/* Quick Actions */
.quick-actions h3 { font-size: 1rem; font-weight: 800; margin-bottom: 1rem; color: var(--text-main); }
.actions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.action-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; cursor: pointer; text-align: center; }
.icon-circle { width: 50px; height: 50px; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; transition: transform 0.2s;}
.icon-circle.health { background: #f0fdfa; color: #0d9488; }
.icon-circle.finance { background: #eef2ff; color: #4f46e5; }
.icon-circle.school { background: #fffbeb; color: #d97706; }
.icon-circle.settings { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.action-item:hover .icon-circle { transform: translateY(-3px); }
.action-item span { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }

/* Events */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-header h3 { font-size: 1rem; font-weight: 800; color: var(--text-main); }
.section-header a { font-size: 0.8rem; color: var(--primary); text-decoration: none; font-weight: 700; background: #e0e7ff; padding: 6px 12px; border-radius: 12px;}

.event-card { background: white; border-radius: 20px; padding: 1.2rem; display: flex; gap: 1rem; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);}
.event-time { font-weight: 800; color: var(--primary); width: 45px; font-size: 1rem;}
.event-details h4 { font-size: 0.95rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.6rem; display: flex; flex-direction: column; gap: 6px;}
.badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 0.65rem; font-weight: 800; width: max-content;}
.badge.pending { background: #fefce8; color: #b45309; border: 1px solid #fef08a;}
.participating-kids { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); font-weight: 600;}
.tiny-avatar { width: 24px; height: 24px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);}

/* Logs */
.audit-log { list-style: none; background: white; border-radius: 20px; padding: 1.2rem; font-size: 0.75rem; color: var(--text-muted); font-family: monospace; max-height: 180px; overflow-y: auto; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);}
.audit-log li { margin-bottom: 0.8rem; padding-bottom: 0.8rem; border-bottom: 1px solid #f1f5f9; line-height: 1.5;}
.audit-log li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.audit-log span { color: var(--primary); font-weight: 800; }

/* Bottom Nav */
.bottom-nav { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(20px); border-top: 1px solid #f1f5f9; display: flex; justify-content: space-around; padding: 1rem 0 calc(1.5rem + env(safe-area-inset-bottom)); z-index:50;}
@media (min-width: 500px) { .bottom-nav { border-radius: 0 0 35px 35px; padding-bottom: 1.5rem; } }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; color: #94a3b8; text-decoration: none; transition: color 0.2s;}
.nav-item.active { color: var(--primary); }
.nav-item i { font-size: 1.3rem; }
.nav-item span { font-size: 0.65rem; font-weight: 800; }

/* Calendar */
.calendar-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;}
.calendar-controls .btn-icon { background: white; border: 1px solid #e2e8f0; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; color: var(--text-main);}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-day-header { text-align: center; font-size: 0.75rem; font-weight: 800; color: #64748b; margin-bottom: 10px;}
.calendar-day { background: white; height: 45px; display: flex; justify-content: center; align-items: center; border-radius: 12px; font-weight: 700; font-size: 0.95rem; color: #334155; cursor: pointer; border: 1px solid #e2e8f0; box-shadow: 0 2px 4px rgba(0,0,0,0.04); transition: all 0.2s;}
.calendar-day:hover { border-color: var(--primary-light); transform: scale(1.05);}
.calendar-day.empty { background: transparent; border: none; cursor: default; }
.calendar-day.active { background: var(--primary); color: white; box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);}

/* Custody styling (Garde alternée) */
.calendar-day.custody-mine { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.calendar-day.custody-other { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }

.custody-toggle { display: flex; background: #f1f5f9; border-radius: 12px; overflow: hidden; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.custody-btn { flex: 1; padding: 10px; border: none; background: transparent; font-size: 0.8rem; font-weight: 800; cursor: pointer; color: #64748b; transition: all 0.2s;}
.custody-btn.active-mine { background: var(--primary); color: white; }
.custody-btn.active-other { background: #f43f5e; color: white; }

/* --------------------------------- */
/* NOVEAUX STYLES POUR L'ONBOARDING  */
/* --------------------------------- */

/* Splash Screen */
#screen-splash { display: none !important; }
#screen-splash.active { display: flex !important; flex-direction: column; justify-content: center; align-items: center; }
.splash-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; }
.loader { width: 40px; height: 40px; border: 4px solid var(--primary-light); border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 2rem auto 0; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse-soft {
    0% { transform: scale(0.98); box-shadow: 0 10px 20px rgba(0,0,0,0.1), 0 0 0 0 rgba(255, 255, 255, 0.3); }
    70% { transform: scale(1.02); box-shadow: 0 20px 30px rgba(0,0,0,0.15), 0 0 0 25px rgba(255, 255, 255, 0); }
    100% { transform: scale(0.98); box-shadow: 0 10px 20px rgba(0,0,0,0.1), 0 0 0 0 rgba(255, 255, 255, 0); }
}
@keyframes loading-slide {
    0% { transform: translateX(-150%); width: 30%; }
    50% { width: 50%; }
    100% { transform: translateX(350%); width: 30%; }
}

/* Carousel */
#screen-carousel { padding: 0; background: white; height: 100%; position: relative;}
.carousel-container { height: 75%; display: flex; text-align: center; justify-content: center; align-items: center; padding: 2rem; }
.carousel-slide { display: flex; flex-direction: column; align-items: center; justify-content: center; animation: fadeIn 0.4s ease-out; }
.slide-img { width: 80%; max-width: 250px; margin-bottom: 2rem; }
.carousel-slide h2 { font-size: 1.6rem; color: var(--text-main); font-weight: 800; margin-bottom: 1rem; line-height: 1.2; }
.carousel-slide p { font-size: 1rem; color: var(--text-muted); line-height: 1.4; }
.carousel-controls { height: 25%; display: flex; flex-direction: column; align-items: center; padding: 0 2rem 2rem; justify-content: space-between; position: absolute; bottom:0; width:100%;}
.dots { display: flex; gap: 8px; margin-bottom: 2rem; }
.dot { width: 10px; height: 10px; border-radius: 5px; background: #e2e8f0; transition: all 0.3s; }
.dot.active { width: 25px; background: var(--primary); }

/* Form UI (Auth) */
.form-group { margin-bottom: 1.2rem; display: flex; flex-direction: column; text-align: left; }
.form-group label { font-size: 0.85rem; font-weight: 800; color: var(--text-main); margin-bottom: 5px; margin-left: 5px; }
.form-group input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid #f1f5f9; background: #f8fafc; font-family: 'Outfit'; font-size: 0.95rem; color: var(--text-main); outline: none; transition: border 0.3s; }
.form-group input:focus { border-color: var(--primary-light); background: white; }

/* =========================================
   AGENDA CALENDAR - FAMILLE
========================================= */
.calendar-container {
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fa 100%);
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 1.5rem 1.2rem;
    box-shadow: 0 12px 35px -10px rgba(99, 102, 241, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.cal-month {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-nav {
    background: #f1f5f9;
    border: none;
    text-align: left;
}

.choice-btn i { 
    font-size: 1.4rem; 
    color: white;
}
.choice-btn span.title { font-weight: 800; color: var(--text-main); font-size: 1.2rem; }
.choice-btn span.desc { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.choice-btn:hover { 
    transform: translateY(-5px) scale(1.02); 
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-light);
    background: white;
}

/* Dashboard */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 2.5rem 1.5rem 1rem;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}
.user-profile { display: flex; align-items: center; gap: 12px; flex: 1;}
.avatar { width: 44px; height: 44px; border-radius: 50%; background-size: cover; border: 2px solid white; box-shadow: 0 4px 10px rgba(0,0,0, 0.08); flex-shrink: 0;}
.context-select {
    appearance: none;
    background: #f1f5f9;
    border: none;
    height: 44px;
    padding: 0 35px 0 20px;
    border-radius: 22px;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230f172a%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 14px top 50%;
    background-size: 10px auto;
    font-family: 'Outfit';
    max-width: 200px;
}
.actions i { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--text-main); background: #f1f5f9; border-radius: 50%; cursor: pointer; transition: background 0.2s;}
.actions i:hover { background: #e2e8f0; }

.dashboard-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    gap: 1.8rem; 
    padding-bottom: 100px; 
}

/* Hero Card Shared/Separated */
.hero-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1.5rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}
.hero-card::after { pointer-events: none;
    content: ''; position: absolute; top: -50%; right: -20%; width: 250px; height: 250px;
    background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero-tag { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #a5b4fc; margin-bottom: 0.5rem; }
.hero-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 1.5rem; line-height: 1.3; }
.kids-avatars { display: flex; gap: -10px; margin-bottom: 1.5rem; }
.kids-avatars img { width: 40px; height: 40px; border-radius: 14px; border: 2px solid white; z-index: 1; box-shadow: 0 4px 6px rgba(0,0,0,0.1);}
.btn-primary { background: white; color: var(--primary); border: none; padding: 0.7rem 1.2rem; border-radius: 12px; font-weight: 800; font-size: 0.85rem; cursor: pointer; position: relative; z-index: 2; box-shadow: 0 4px 10px rgba(0,0,0,0.1); width: 100%;}

/* Quick Actions */
.quick-actions h3 { font-size: 1rem; font-weight: 800; margin-bottom: 1rem; color: var(--text-main); }
.actions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.action-item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; cursor: pointer; text-align: center; }
.icon-circle { width: 50px; height: 50px; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; transition: transform 0.2s;}
.icon-circle.health { background: #f0fdfa; color: #0d9488; }
.icon-circle.finance { background: #eef2ff; color: #4f46e5; }
.icon-circle.school { background: #fffbeb; color: #d97706; }
.icon-circle.settings { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.action-item:hover .icon-circle { transform: translateY(-3px); }
.action-item span { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }

/* Events */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-header h3 { font-size: 1rem; font-weight: 800; color: var(--text-main); }
.section-header a { font-size: 0.8rem; color: var(--primary); text-decoration: none; font-weight: 700; background: #e0e7ff; padding: 6px 12px; border-radius: 12px;}

.event-card { background: white; border-radius: 20px; padding: 1.2rem; display: flex; gap: 1rem; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);}
.event-time { font-weight: 800; color: var(--primary); width: 45px; font-size: 1rem;}
.event-details h4 { font-size: 0.95rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.6rem; display: flex; flex-direction: column; gap: 6px;}
.badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 0.65rem; font-weight: 800; width: max-content;}
.badge.pending { background: #fefce8; color: #b45309; border: 1px solid #fef08a;}
.participating-kids { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); font-weight: 600;}
.tiny-avatar { width: 24px; height: 24px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);}

/* Logs */
.audit-log { list-style: none; background: white; border-radius: 20px; padding: 1.2rem; font-size: 0.75rem; color: var(--text-muted); font-family: monospace; max-height: 180px; overflow-y: auto; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);}
.audit-log li { margin-bottom: 0.8rem; padding-bottom: 0.8rem; border-bottom: 1px solid #f1f5f9; line-height: 1.5;}
.audit-log li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.audit-log span { color: var(--primary); font-weight: 800; }

/* Bottom Nav */
.bottom-nav { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(20px); border-top: 1px solid #f1f5f9; display: flex; justify-content: space-around; padding: 1rem 0 calc(1.5rem + env(safe-area-inset-bottom)); z-index:50;}
@media (min-width: 500px) { .bottom-nav { border-radius: 0 0 35px 35px; padding-bottom: 1.5rem; } }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; color: #94a3b8; text-decoration: none; transition: color 0.2s;}
.nav-item.active { color: var(--primary); }
.nav-item i { font-size: 1.3rem; }
.nav-item span { font-size: 0.65rem; font-weight: 800; }

/* Calendar */
.calendar-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;}
.calendar-controls .btn-icon { background: white; border: 1px solid #e2e8f0; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; color: var(--text-main);}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-day-header { text-align: center; font-size: 0.75rem; font-weight: 800; color: #64748b; margin-bottom: 10px;}
.calendar-day { background: #ffffff; height: 45px; display: flex; justify-content: center; align-items: center; border-radius: 14px; font-weight: 700; font-size: 0.95rem; color: #334155; cursor: pointer; border: 1px solid #e2e8f0; box-shadow: 0 2px 6px rgba(0,0,0,0.03); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);}
.calendar-day:hover { border-color: #8b5cf6; transform: scale(1.05) translateY(-2px); box-shadow: 0 6px 15px rgba(99, 102, 241, 0.2);}
.calendar-day.empty { background: transparent; border: none; cursor: default; box-shadow: none; }
.calendar-day.active { background: linear-gradient(135deg, #6366f1, #a855f7); color: white; border: none; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);}

/* Custody styling (Garde alternée) */
.calendar-day.custody-mine { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.calendar-day.custody-other { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }

.custody-toggle { display: flex; background: #f1f5f9; border-radius: 12px; overflow: hidden; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.custody-btn { flex: 1; padding: 10px; border: none; background: transparent; font-size: 0.8rem; font-weight: 800; cursor: pointer; color: #64748b; transition: all 0.2s;}
.custody-btn.active-mine { background: var(--primary); color: white; }
.custody-btn.active-other { background: #f43f5e; color: white; }

/* --------------------------------- */
/* NOVEAUX STYLES POUR L'ONBOARDING  */
/* --------------------------------- */

/* Splash Screen */
#screen-splash { display: none !important; }
#screen-splash.active { display: flex !important; flex-direction: column; justify-content: center; align-items: center; }
.splash-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; }
.loader { width: 40px; height: 40px; border: 4px solid var(--primary-light); border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 2rem auto 0; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Carousel */
#screen-carousel { padding: 0; background: white; height: 100%; position: relative;}
.carousel-container { height: 75%; display: flex; text-align: center; justify-content: center; align-items: center; padding: 2rem; }
.carousel-slide { display: flex; flex-direction: column; align-items: center; justify-content: center; animation: fadeIn 0.4s ease-out; }
.slide-img { width: 80%; max-width: 250px; margin-bottom: 2rem; }
.carousel-slide h2 { font-size: 1.6rem; color: var(--text-main); font-weight: 800; margin-bottom: 1rem; line-height: 1.2; }
.carousel-slide p { font-size: 1rem; color: var(--text-muted); line-height: 1.4; }
.carousel-controls { height: 25%; display: flex; flex-direction: column; align-items: center; padding: 0 2rem 2rem; justify-content: space-between; position: absolute; bottom:0; width:100%;}
.dots { display: flex; gap: 8px; margin-bottom: 2rem; }
.dot { width: 10px; height: 10px; border-radius: 5px; background: #e2e8f0; transition: all 0.3s; }
.dot.active { width: 25px; background: var(--primary); }

/* Form UI (Auth) */
.form-group { margin-bottom: 1.2rem; display: flex; flex-direction: column; text-align: left; }
.form-group label { font-size: 0.85rem; font-weight: 800; color: var(--text-main); margin-bottom: 5px; margin-left: 5px; }
.form-group input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid #f1f5f9; background: #f8fafc; font-family: 'Outfit'; font-size: 0.95rem; color: var(--text-main); outline: none; transition: border 0.3s; }
.form-group input:focus { border-color: var(--primary-light); background: white; }

/* =========================================
   AGENDA CALENDAR - VUE MOIS & VUE JOUR
========================================= */
.calendar-container {
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fa 100%);
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 1.5rem 1.2rem;
    box-shadow: 0 12px 35px -10px rgba(99, 102, 241, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.cal-month {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-nav {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px; /* IMPORTANT: Doit matcher le gap du .calendar-grid à la ligne ~260 */
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Modificateurs pour la grille existante de l'agenda */
.calendar-grid {
    gap: 8px; /* On s'assure du même gap */
}

.calendar-day {
    flex-direction: column; /* Pour afficher le jour ET les points */
    gap: 3px;
    position: relative;
    box-sizing: border-box;
}

.calendar-day.empty {
    visibility: hidden; /* Garantit que la dimension reste identique aux autres jours */
}

.day-dots {
    display: flex;
    gap: 2px;
    height: 4px; /* Empêche le conteneur de prendre 0px */
}

.event-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.hour-line:hover {
    background-color: #f8fafc;
}

/* Modificateurs Généraux */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.screen-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.screen-header .icon-btn {
    background: white;
    border: 1px solid #e2e8f0;
    width: 45px;
    height: 45px;
    border-radius: 14px;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}


/* FIx Scrollbar on Desktop & Bottom Nav Bleeding */
#app-container::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
#app-container, body { -ms-overflow-style: none; scrollbar-width: none; }
.bottom-nav { background: rgba(255, 255, 255, 1) !important; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); z-index: 9999; }





/* DESKTOP RESPONSIVE LAYOUT (TRUE PC APP)              */
/* ==================================================== */
@media (min-width: 1024px) {
    /* 1. App Container becomes full screen */
    #app-container {
        max-width: 100%;
        height: 100vh;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    /* 2. Authentication & Splash screens centered as floating cards */
    #screen-splash, #screen-carousel, #screen-auth {
        max-width: 500px;
        margin: auto;
        height: 90vh !important;
        max-height: 800px;
        border-radius: 32px;
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
        overflow: hidden;
        border: 1px solid #e2e8f0;
    }

    /* 3. Dashboard layout: Sidebar + Content using CSS Grid */
    #app-dashboard.active {
        display: grid;
        grid-template-columns: 280px 1fr;
        grid-template-rows: auto 1fr;
        width: 100%;
        height: 100vh;
        overflow: hidden;
    }

    /* Top Nav (moved to Left Sidebar Top) */
    .top-nav {
        grid-column: 1;
        grid-row: 1;
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        width: 100%;
        background: white;
        padding: 2rem 1.5rem 1rem 1.5rem;
        border-right: 1px solid #e2e8f0;
        box-shadow: none;
        z-index: 10;
    }

    .top-nav .user-profile {
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .top-nav .context-select {
        width: 100%;
        max-width: 100%;
        text-align: center;
        background-position: right 10px top 50%;
    }

    .top-nav > div:nth-child(2) {
        /* The center date/logo div */
        display: flex;
        flex-direction: row !important;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: #f8fafc;
        padding: 10px;
        border-radius: 16px;
    }

    .top-nav > div:nth-child(2) div:first-child {
        margin-bottom: 0 !important;
    }

    .top-nav .actions {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    /* 4. Bottom Nav becomes Left Sidebar Bottom */
    .bottom-nav {
        grid-column: 1;
        grid-row: 2;
        position: relative;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        width: 100%;
        height: 100%;
        border-top: none;
        border-right: 1px solid #e2e8f0;
        border-radius: 0 !important;
        padding: 1rem 1.5rem 2rem 1.5rem !important;
        box-shadow: none !important;
        background: white !important;
    }

    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px 20px;
        border-radius: 16px;
        margin-bottom: 10px;
        transition: all 0.2s;
    }

    .nav-item i { margin-right: 15px; font-size: 1.4rem; width: 25px; text-align: center; }
    .nav-item span { font-size: 1rem; font-weight: 800; }
    .nav-item:hover { background: #f8fafc; transform: translateX(5px); }
    .nav-item.active { background: #eef2ff; color: var(--primary); }

    /* 5. Content Area (Full Right Column) */
    .dashboard-content {
        grid-column: 2;
        grid-row: 1 / 3;
        padding: 0;
        height: 100vh;
        position: relative;
        overflow-y: auto;
    }

    /* Center UI elements to prevent them stretching too wide */
    .hero-card, .quick-actions, #settings-members-section, #settings-network-section, .calendar-container {
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Screens internal padding */
    #screen-home, #screen-agenda, #screen-vault, #screen-messages, #screen-finances, #screen-settings {
        padding: 2rem 4rem 4rem;
    }
}

/* --- MODALS --- */
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); z-index:99999; justify-content:center; align-items:center; }
.modal-container { background:white; padding:25px; border-radius:24px; width:90%; max-width:500px; max-height:85dvh; overflow-y:auto; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); margin: 20px 0; }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.modal-title { margin:0; font-size:1.2rem; font-weight:800; color:var(--text-main); display:flex; align-items:center; gap:8px; }
.modal-close-btn { border:none; background:#f1f5f9; width:36px; height:36px; border-radius:50%; font-size:1.2rem; color:var(--text-muted); cursor:pointer; display:flex; justify-content:center; align-items:center; transition: all 0.2s; }
.modal-close-btn:hover { background:#e2e8f0; color:#0f172a; }

/* =========================================
   TOGGLE SWITCH STYLES (iOS / MODERN)
   ========================================= */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

