/* ============================================================
   COPALIO.CSS — Feuille de style globale v1.0
   Toutes les variables, composants et layouts de l'app
   Import : <link rel="stylesheet" href="/assets/css/copalio.css">
   ============================================================ */

/* ============================================================
   1. VARIABLES CSS (charte graphique officielle)
   ============================================================ */
:root {
    /* Couleurs principales */
    --coral:          #FF7A55;
    --coral-dark:     #F55C35;
    --coral-deep:     #D94420;
    --coral-light:    #FFC5AD;
    --coral-bg:       #FFF4F0;
    --peach:          #FFEEE6;

    /* Accent bleu */
    --blue:           #4A9FE8;
    --blue-dark:      #2B84D4;
    --blue-bg:        #F0F6FF;

    /* Statuts */
    --green:          #3EBD74;
    --green-dark:     #29A35D;
    --green-bg:       #F0FAF4;
    --amber:          #F5B83D;
    --amber-dark:     #E09A1A;
    --amber-bg:       #FFFBF0;
    --red:            #F55757;
    --red-dark:       #DC3535;
    --red-bg:         #FFF5F5;

    /* Neutres chauds */
    --white:          #FFFFFF;
    --bg:             #F5EFE6;
    --bg2:            #EDE5D8;
    --border:         #DDD4C4;
    --border-light:   #EDE5D8;
    --text:           #1C1208;
    --text-soft:      #6E6050;
    --text-label:     #4A3F32;
    --text-placeholder: #C4B9A8;

    /* Typographie */
    --font-display:   'Nunito', sans-serif;
    --font-body:      'Quicksand', sans-serif;

    /* Tailles texte */
    --text-xs:        0.75rem;
    --text-sm:        0.875rem;
    --text-base:      1rem;
    --text-lg:        1.125rem;
    --text-xl:        1.25rem;
    --text-2xl:       1.5rem;
    --text-3xl:       1.875rem;

    /* Rayons */
    --radius-sm:      8px;
    --radius:         15px;
    --radius-lg:      20px;
    --radius-full:    9999px;

    /* Ombres */
    --shadow-xs:      0 1px 3px rgba(180,140,100,0.08);
    --shadow-sm:      0 2px 8px rgba(180,140,100,0.10);
    --shadow:         0 4px 16px rgba(180,140,100,0.13);
    --shadow-lg:      0 8px 28px rgba(180,140,100,0.16);
    --shadow-coral:   0 4px 16px rgba(245,92,53,0.30);

    /* Espacements */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Layout app */
    --navbar-height-top:    64px;
    --navbar-height-bottom: 68px;
    --content-max-width:    900px;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg);
    color-scheme: light only;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: var(--font-body); }

/* ============================================================
   3. TYPOGRAPHIE
   ============================================================ */
.t-display {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.5px;
}
.t-h1 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.t-h2 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text);
}
.t-h3 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
}
.t-body  { font-size: var(--text-base); font-weight: 500; line-height: 1.7; }
.t-small { font-size: var(--text-sm);   font-weight: 500; color: var(--text-soft); }
.t-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-soft);
}

/* ============================================================
   4. LAYOUT AUTH (pages login, register, forgot…)
   ============================================================ */
.layout-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 60px;
    background: var(--bg);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    text-decoration: none;
}
.auth-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-logo-text {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}
.auth-logo-text span { color: var(--coral); }

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
}
.auth-card-wide { max-width: 520px; }

.auth-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}
.auth-subtitle {
    font-size: 14px;
    color: var(--text-soft);
    font-weight: 500;
    margin-bottom: 28px;
    line-height: 1.6;
}

.auth-footer-link {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-soft);
    font-weight: 500;
}
.auth-footer-link a {
    color: var(--coral-dark);
    font-weight: 700;
    text-decoration: none;
}
.auth-footer-link a:hover { text-decoration: underline; }

/* ============================================================
   5. LAYOUT APP (pages connectées)
   ============================================================ */

/* Corps app — décalage pour navbar */
.layout-app {
    min-height: 100vh;
    background: var(--bg);
    padding-bottom: var(--navbar-height-bottom); /* mobile : espace bottom nav */
}

/* Zone de contenu principal */
.app-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 24px 16px;
}

/* En-tête de page interne */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}
.page-header-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text);
}
.page-header-sub {
    font-size: var(--text-sm);
    color: var(--text-soft);
    font-weight: 500;
    margin-top: 2px;
}

/* ============================================================
   6. NAVBAR TOP (desktop ≥ 768px)
   ============================================================ */
.navbar-top {
    display: none; /* caché sur mobile */
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-height-top);
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}
.navbar-top-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 24px;
}

/* Logo dans la navbar */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-logo-text {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}
.nav-logo-text span { color: var(--coral); }

/* Liens de navigation desktop */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-soft);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}
.nav-link.active {
    background: var(--coral-bg);
    color: var(--coral-dark);
}
.nav-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.nav-link.active svg { opacity: 1; }

/* Actions droite navbar */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.nav-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    color: var(--white);
    cursor: pointer;
    transition: transform 0.15s;
    text-decoration: none;
    line-height: 1;
}
.nav-avatar:hover { transform: scale(1.05); }
.nav-avatar-a { background: linear-gradient(135deg, var(--coral), var(--coral-dark)); }
.nav-avatar-b { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); }

/* ============================================================
   7. NAVBAR BOTTOM (mobile < 768px)
   ============================================================ */
.navbar-bottom {
    display: flex; /* visible sur mobile */
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--navbar-height-bottom);
    background: var(--white);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 16px rgba(180,140,100,0.10);
    padding-bottom: env(safe-area-inset-bottom, 0px); /* iPhone notch */
}
.navbar-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    padding: 0 8px;
}
.nav-item-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s;
    min-width: 56px;
    cursor: pointer;
}
.nav-item-bottom:hover { background: var(--bg); }
.nav-item-bottom.active { background: var(--coral-bg); }

.nav-item-icon {
    width: 24px; height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    transition: color 0.15s;
}
.nav-item-bottom.active .nav-item-icon { color: var(--coral-dark); }

.nav-item-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-soft);
    font-family: var(--font-body);
    transition: color 0.15s;
}
.nav-item-bottom.active .nav-item-label { color: var(--coral-dark); }

.nav-item-dot {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--coral);
    margin-top: 1px;
    opacity: 0;
}
.nav-item-bottom.active .nav-item-dot { opacity: 1; }

/* Badge notification */
.nav-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--white);
}

/* ============================================================
   8. RESPONSIVE — Activation navbar desktop
   ============================================================ */
@media (min-width: 768px) {
    .navbar-top    { display: block; }
    .navbar-bottom { display: none; }

    .layout-app {
        padding-bottom: 0;
        padding-top: 0;
    }
    .app-content { padding: 32px 24px; }
}

/* ============================================================
   9. CARTES
   ============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.card-flat {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
}
.card-coral   { background: var(--coral-bg); }
.card-blue    { background: var(--blue-bg); }
.card-green   { background: var(--green-bg); }
.card-amber   { background: var(--amber-bg); }
.card-bordered-coral { border-left: 4px solid var(--coral); }
.card-bordered-blue  { border-left: 4px solid var(--blue); }
.card-bordered-green { border-left: 4px solid var(--green); }
.card-bordered-amber { border-left: 4px solid var(--amber); }

/* ============================================================
   10. BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: var(--text-base);
    border: none;
    cursor: pointer;
    border-radius: var(--radius-full);
    padding: 12px 24px;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn-full { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    color: var(--white);
    box-shadow: var(--shadow-coral);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(245,92,53,0.40);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--peach);
    color: var(--coral-dark);
}
.btn-secondary:hover { background: var(--coral-bg); }

.btn-outline {
    background: transparent;
    color: var(--coral-dark);
    border: 2px solid var(--coral-light);
}
.btn-outline:hover { background: var(--coral-bg); border-color: var(--coral); }

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
}
.btn-ghost:hover { background: var(--bg2); color: var(--text); }

.btn-blue {
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: var(--white);
    box-shadow: 0 4px 16px rgba(74,159,232,0.30);
}
.btn-blue:hover {
    box-shadow: 0 6px 20px rgba(74,159,232,0.40);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--red-bg);
    color: var(--red-dark);
    border: 2px solid var(--red);
}
.btn-danger:hover { background: var(--red); color: var(--white); }

.btn-google {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-google:hover { border-color: var(--blue); background: #F8FBFF; }

/* Tailles */
.btn-sm { padding: 8px 16px; font-size: var(--text-sm); }
.btn-lg { padding: 15px 32px; font-size: var(--text-lg); }
.btn-icon {
    width: 40px; height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--bg2);
    color: var(--text-soft);
    border: none;
}
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-icon-round {
    width: 40px; height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg2);
    color: var(--text-soft);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}
.btn-icon-round:hover { background: var(--coral-bg); color: var(--coral-dark); }

/* ============================================================
   11. FORMULAIRES
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-label);
    margin-bottom: 7px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-width: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text);
    background: #FDFAF6;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--coral);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(255,122,85,0.12);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-placeholder); }

.form-input-error  { border-color: var(--red) !important; background: var(--red-bg); }
.form-input-success{ border-color: var(--green) !important; }

.form-hint {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-soft);
    margin-top: 5px;
}
.form-hint-error   { color: var(--red-dark); }
.form-hint-success { color: var(--green-dark); }

.form-textarea { resize: vertical; min-height: 100px; }

.form-select { appearance: none; cursor: pointer; }

/* Checkbox et radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-soft);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--coral);
    cursor: pointer;
    flex-shrink: 0;
}

/* Grid 2 colonnes pour formulaires */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-row-full { grid-column: 1 / -1; }

/* ============================================================
   12. ALERTES & NOTIFICATIONS
   ============================================================ */
.alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    align-items: flex-start;
    line-height: 1.6;
    margin-bottom: 16px;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--green-bg); color: var(--green-dark); border-left: 3px solid var(--green); }
.alert-warning { background: var(--amber-bg); color: var(--amber-dark); border-left: 3px solid var(--amber); }
.alert-error   { background: var(--red-bg);   color: var(--red-dark);   border-left: 3px solid var(--red); }
.alert-info    { background: var(--blue-bg);  color: var(--blue-dark);  border-left: 3px solid var(--blue); }

/* ============================================================
   13. BADGES & STATUTS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    font-family: var(--font-body);
    white-space: nowrap;
}
.badge-dot::before {
    content: '';
    display: inline-block;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-coral   { background: var(--coral-bg);  color: var(--coral-deep); }
.badge-blue    { background: var(--blue-bg);   color: var(--blue-dark); }
.badge-green   { background: var(--green-bg);  color: var(--green-dark); }
.badge-amber   { background: var(--amber-bg);  color: var(--amber-dark); }
.badge-red     { background: var(--red-bg);    color: var(--red-dark); }
.badge-gray    { background: var(--bg2);       color: var(--text-soft); }

/* ============================================================
   14. AVATARS
   ============================================================ */
.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--white);
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
}
.avatar-xs { width: 24px; height: 24px; font-size: 9px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }
.avatar-a  { background: linear-gradient(135deg, var(--coral), var(--coral-dark)); }
.avatar-b  { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); }

/* ============================================================
   15. DIVISEURS
   ============================================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-soft);
    font-size: var(--text-xs);
    font-weight: 600;
    margin: 20px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
hr.divider-line {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: 20px 0;
}

/* ============================================================
   16. UTILITAIRES
   ============================================================ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-coral   { color: var(--coral-dark); }
.text-soft    { color: var(--text-soft); }
.text-green   { color: var(--green-dark); }
.text-red     { color: var(--red-dark); }
.text-amber   { color: var(--amber-dark); }
.text-bold    { font-weight: 700; }
.text-display { font-family: var(--font-display); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-2   { gap: var(--space-2); }
.flex-gap-3   { gap: var(--space-3); }
.flex-gap-4   { gap: var(--space-4); }
.flex-wrap    { flex-wrap: wrap; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.hidden  { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   17. SECTION LABEL (titres de section dans l'app)
   ============================================================ */
.section-label {
    font-size: var(--text-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--coral);
    margin-bottom: 14px;
}

/* ============================================================
   18. SKELETON LOADER
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg2) 25%, var(--border-light) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   19. RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 767px) {
    .hide-mobile  { display: none !important; }
    .form-row     { grid-template-columns: 1fr; }
    .grid-2       { grid-template-columns: 1fr; }
    .grid-3       { grid-template-columns: 1fr 1fr; }
    .auth-card    { padding: 28px 20px; }
}
@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
}

/* ============================================================
   20. NAVBAR — BADGES NOTIFICATION
   ============================================================ */
 
/* Wrapper relatif pour positionner le badge sur l'icône */
.nav-link-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
 
/* Badge sur nav-link desktop */
.nav-link-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: var(--white);
    font-size: 9px;
    font-weight: 800;
    border-radius: var(--radius-full);
    border: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}
 
/* Badge sur nav-item-bottom mobile */
.nav-badge-count {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: var(--white);
    font-size: 9px;
    font-weight: 800;
    border-radius: var(--radius-full);
    border: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}
 
/* ============================================================
   21. MESSAGERIE
   ============================================================ */
 
/* Barre de titre conversation */
.msg-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}
.msg-topbar-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.msg-topbar-name {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.msg-topbar-sub {
    font-size: var(--text-xs);
    color: var(--text-soft);
    font-weight: 500;
    margin-top: 1px;
}
 
/* Desktop : compenser la top navbar */
@media (min-width: 768px) {
    .msg-topbar {
        top: var(--navbar-height-top);
    }
}
 
/* Zone de feed messages */
.msg-feed {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Hauteur dynamique : viewport - topbar - topnav (desktop) - composer */
    min-height: 200px;
    overflow-y: auto;
    /* Hauteur calculée pour tenir dans l'écran */
    height: calc(100dvh - 64px - 72px - 68px);
}
 
@media (min-width: 768px) {
    .msg-feed {
        height: calc(100dvh - var(--navbar-height-top) - 64px - 72px);
        padding: 20px 24px 0;
    }
}
 
/* Séparateur de date */
.msg-date-sep {
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-soft);
    margin: 12px 0 6px;
    position: relative;
}
.msg-date-sep::before,
.msg-date-sep::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28%;
    height: 1px;
    background: var(--border-light);
}
.msg-date-sep::before { left: 0; }
.msg-date-sep::after  { right: 0; }
 
/* État vide */
.msg-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 48px 0;
    text-align: center;
}
 
/* Ligne de message */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 75%;
}
.msg-row-mine  { align-self: flex-end;  flex-direction: row-reverse; }
.msg-row-other { align-self: flex-start; }
 
/* Avatar dans le feed */
.msg-avatar { flex-shrink: 0; }
 
/* Bulle */
.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 100%;
    word-break: break-word;
    box-shadow: var(--shadow-xs);
}
.msg-bubble-mine {
    background: var(--coral);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.msg-bubble-other {
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
}
 
.msg-text {
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.55;
}
 
/* Métadonnées heure + coche */
.msg-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}
.msg-time {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.7;
}
.msg-bubble-other .msg-time { color: var(--text-soft); }
 
/* Coche lu */
.msg-read {
    color: rgba(255,255,255,0.5);
    display: inline-flex;
    align-items: center;
}
.msg-read-done {
    color: var(--white);
}
 
/* Zone de saisie */
.msg-composer {
    position: sticky;
    bottom: var(--navbar-height-bottom);
    z-index: 50;
    background: var(--white);
    border-top: 1px solid var(--border-light);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) {
    .msg-composer {
        bottom: 0;
        padding: 12px 24px;
    }
}
 
.msg-form {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
 
.msg-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: max(16px, var(--text-sm));
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 22px;
    padding: 10px 16px;
    outline: none;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    transition: border-color 0.15s;
}
.msg-input:focus {
    border-color: var(--coral);
    background: var(--white);
}
.msg-input::placeholder { color: var(--text-placeholder); }
 
.msg-send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral), var(--coral-dark));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    box-shadow: var(--shadow-coral);
    transition: transform 0.15s, box-shadow 0.15s;
}
.msg-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(245,92,53,0.40);
}
.msg-send-btn:active { transform: scale(0.95); }

/* ============================================================
   22. FIX INPUT DATE iOS (débordement natif)
   ============================================================ */
input[type="date"].form-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
