/*
 * Tableau de bord — Espace client Inkwell
 */

.tableau-de-bord {
    padding: 40px 0 72px;
}

/* --- Bannière d'accueil --- */

.tdb-banniere {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: linear-gradient(135deg, var(--couleur-anthracite) 0%, #1a262c 100%);
    border-radius: var(--rayon-carte);
    padding: 28px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.tdb-banniere::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 103, 106, 0.25) 0%, transparent 70%);
}

.tdb-banniere__gauche {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.tdb-banniere__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--couleur-corail);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tdb-banniere__texte {
    min-width: 0;
}

.tdb-banniere__message {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}

.tdb-banniere__citation {
    font-family: var(--police-exergue);
    font-style: italic;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 460px;
}

.tdb-banniere__actions {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.tdb-action-icone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.tdb-action-icone:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.tdb-action-icone i {
    font-size: 1.15rem;
    color: var(--couleur-corail);
}

/* --- Statistiques --- */

.tdb-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.tdb-stat {
    background-color: #ffffff;
    border-radius: var(--rayon-carte);
    box-shadow: var(--ombre-carte);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.tdb-stat__icone {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #ffffff;
    flex-shrink: 0;
}

.tdb-stat--corail .tdb-stat__icone { background-color: var(--couleur-corail); }
.tdb-stat--bleu .tdb-stat__icone { background-color: var(--couleur-bleu-vif); }
.tdb-stat--vert .tdb-stat__icone { background-color: var(--couleur-vert-emeraude); }
.tdb-stat--ocre .tdb-stat__icone { background-color: var(--couleur-ocre); }

.tdb-stat__valeur {
    font-family: var(--police-titres);
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--couleur-anthracite);
    line-height: 1.1;
}

.tdb-stat__label {
    font-size: 0.78rem;
    color: rgba(38, 53, 60, 0.55);
}

/* --- Grille principale --- */

.tableau-de-bord__grille {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}

.tdb-carte {
    background-color: #ffffff;
    border-radius: var(--rayon-carte);
    box-shadow: var(--ombre-carte);
    padding: 28px 24px;
}

.tdb-carte + .tdb-carte {
    margin-top: 20px;
}

.tdb-carte__titre {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    color: var(--couleur-anthracite);
    margin-bottom: 20px;
}

.tdb-carte__titre i {
    color: var(--couleur-corail);
}

/* --- État vide générique (histoires, activité) --- */

.tdb-etat-vide {
    text-align: center;
    padding: 40px 20px;
}

.tdb-etat-vide--compact {
    padding: 28px 20px;
}

.tdb-etat-vide__icone {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background-color: var(--couleur-beige);
    color: rgba(38, 53, 60, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.tdb-etat-vide--compact .tdb-etat-vide__icone {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.tdb-etat-vide__titre {
    font-size: 1rem;
    font-weight: 700;
    color: var(--couleur-anthracite);
    margin-bottom: 8px;
}

.tdb-etat-vide__texte {
    font-size: 0.88rem;
    color: rgba(38, 53, 60, 0.6);
    max-width: 340px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.tdb-etat-vide--compact .tdb-etat-vide__texte {
    margin-bottom: 0;
    max-width: 300px;
}

/* --- Carte profil (barre latérale) --- */

.tdb-profil {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(38, 53, 60, 0.08);
}

.tdb-profil__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--couleur-corail);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.tdb-profil__nom {
    font-weight: 700;
    font-size: 1rem;
    color: var(--couleur-anthracite);
}

.tdb-profil__role {
    font-size: 0.82rem;
    color: rgba(38, 53, 60, 0.55);
    margin-bottom: 10px;
}

.tdb-profil__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--couleur-vert-emeraude);
    background-color: rgba(1, 144, 124, 0.1);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.tdb-profil__membre-depuis {
    font-size: 0.76rem;
    color: rgba(38, 53, 60, 0.45);
}

/* --- Complétion de profil --- */

.tdb-completion {
    transition: opacity 0.45s ease, transform 0.45s ease, max-height 0.45s ease, margin-top 0.45s ease, padding 0.45s ease;
}

.tdb-completion--disparition {
    opacity: 0;
    transform: translateY(-8px);
}

.tdb-completion__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tdb-completion__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--couleur-anthracite);
}

.tdb-completion__pourcentage {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--couleur-corail);
}

.tdb-completion__barre {
    height: 8px;
    background-color: var(--couleur-beige);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 14px;
}

.tdb-completion__remplissage {
    height: 100%;
    background-color: var(--couleur-corail);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.tdb-completion__liste {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tdb-completion__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: rgba(38, 53, 60, 0.55);
}

.tdb-completion__item i {
    font-size: 0.75rem;
    color: rgba(38, 53, 60, 0.25);
    width: 14px;
}

.tdb-completion__item--fait {
    color: var(--couleur-anthracite);
}

.tdb-completion__item--fait i {
    color: var(--couleur-vert-emeraude);
}

@media (max-width: 900px) {
    .tdb-banniere {
        flex-direction: column;
        align-items: flex-start;
    }

    .tdb-banniere__actions {
        width: 100%;
    }

    .tdb-action-icone {
        flex: 1;
    }

    .tdb-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tableau-de-bord__grille {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tdb-stats {
        grid-template-columns: 1fr;
    }

    .tdb-banniere__actions {
        flex-direction: column;
    }
}

.tdb-securite {
    margin-bottom: 20px;
}

.tdb-securite__jauge {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.tdb-securite__cercle {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.tdb-securite__cercle svg {
    transform: rotate(-90deg);
}

.tdb-securite__cercle-fond {
    fill: none;
    stroke: rgba(38, 53, 60, 0.08);
    stroke-width: 6;
}

.tdb-securite__cercle-progression {
    fill: none;
    stroke: var(--couleur-vert-emeraude);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.tdb-securite__pourcentage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--couleur-anthracite);
}

.tdb-securite__liste {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tdb-securite__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(38, 53, 60, 0.55);
}

.tdb-securite__item--ok {
    color: var(--couleur-anthracite);
}

.tdb-securite__item--ok i {
    color: var(--couleur-vert-emeraude);
}

.tdb-securite__item--attention i {
    color: var(--couleur-ocre);
}

.tdb-securite__lien {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--couleur-corail);
    margin-left: auto;
}

.tdb-securite {
    transition: opacity 0.45s ease, transform 0.45s ease, max-height 0.45s ease, margin-top 0.45s ease, padding 0.45s ease;
}

.tdb-securite--disparition {
    opacity: 0;
    transform: translateY(-8px);
}

/* ==========================================================================
   ANIMATIONS D'ENTRÉE — cascade au chargement de la page
   ========================================================================== */

.tdb-banniere,
.tdb-stats > *,
.tableau-de-bord__grille > * {
    animation: tdb-apparition 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.tdb-banniere { animation-delay: 0.05s; }
.tdb-stats > *:nth-child(1) { animation-delay: 0.15s; }
.tdb-stats > *:nth-child(2) { animation-delay: 0.2s; }
.tdb-stats > *:nth-child(3) { animation-delay: 0.25s; }
.tdb-stats > *:nth-child(4) { animation-delay: 0.3s; }
.tableau-de-bord__grille > *:nth-child(1) { animation-delay: 0.35s; }
.tableau-de-bord__grille > *:nth-child(2) { animation-delay: 0.4s; }

@keyframes tdb-apparition {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   ÉTAT DE CHARGEMENT — évite le flash "?" / textes vides avant réception
   des données utilisateur (skeleton pulsé, remplacé dès inkwell:utilisateur-charge)
   ========================================================================== */

.tdb-skeleton {
    color: transparent !important;
    background-color: rgba(38, 53, 60, 0.08);
    border-radius: 6px;
    animation: tdb-pulse 1.4s ease-in-out infinite;
}

.tdb-banniere__avatar.tdb-skeleton,
.tdb-profil__avatar.tdb-skeleton,
[data-avatar-initiale].tdb-skeleton {
    background-color: rgba(38, 53, 60, 0.12) !important;
}

@keyframes tdb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tdb-profil__derniere-connexion {
    font-size: 0.76rem;
    color: rgba(38, 53, 60, 0.45);
    margin-top: 2px;
}

.tdb-mes-histoires-liste {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.tdb-mon-histoire-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.tdb-mon-histoire-item:hover {
    background-color: rgba(255, 103, 106, 0.05);
}

.tdb-mon-histoire-item__couverture {
    width: 42px;
    height: 56px;
    border-radius: 6px;
    background-color: rgba(38, 53, 60, 0.06);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(38, 53, 60, 0.25);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.tdb-mon-histoire-item__corps {
    flex: 1;
    min-width: 0;
}

.tdb-mon-histoire-item__titre {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--couleur-anthracite);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tdb-mon-histoire-item__meta {
    font-size: 0.78rem;
    color: rgba(38, 53, 60, 0.5);
    margin-top: 2px;
}

.tdb-mon-histoire-item__badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}

.tdb-mon-histoire-item__badge--attente {
    background-color: rgba(202, 136, 0, 0.1);
    color: var(--couleur-ocre);
}

.tdb-mon-histoire-item__badge--neutre {
    background-color: rgba(43, 119, 255, 0.1);
    color: var(--couleur-bleu-vif);
}

.tdb-mon-histoire-item__badge--succes {
    background-color: rgba(1, 144, 124, 0.1);
    color: var(--couleur-vert-emeraude);
}

.tdb-mon-histoire-voir-tout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(38, 53, 60, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--couleur-corail);
}

[data-theme="sombre"] .tdb-mon-histoire-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

[data-theme="sombre"] .tdb-mon-histoire-item__couverture {
    background-color: rgba(255, 255, 255, 0.06);
    color: rgba(240, 235, 230, 0.25);
}

[data-theme="sombre"] .tdb-mon-histoire-item__titre {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-mon-histoire-voir-tout {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   ACTIVITÉ RÉCENTE — en-tête, filtres
   ========================================================================== */

.tdb-activite-entete {
    margin-bottom: 12px;
}

.tdb-activite-badge-nouveau {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: var(--couleur-corail);
    color: #ffffff;
    margin-left: 6px;
    vertical-align: middle;
}

.tdb-activite-filtres {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 18px;
}

.tdb-activite-filtre {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: 999px;
    background-color: rgba(38, 53, 60, 0.05);
    color: rgba(38, 53, 60, 0.55);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tdb-activite-filtre--actif {
    background-color: var(--couleur-corail);
    color: #ffffff;
}

[data-theme="sombre"] .tdb-activite-filtre {
    background-color: rgba(255, 255, 255, 0.06);
    color: rgba(240, 235, 230, 0.55);
}

/* ==========================================================================
   TIMELINE — regroupement par période
   ========================================================================== */

.tdb-activite-periode-titre {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(38, 53, 60, 0.4);
    margin: 18px 0 10px;
}

.tdb-activite-periode-titre:first-child {
    margin-top: 0;
}

[data-theme="sombre"] .tdb-activite-periode-titre {
    color: rgba(240, 235, 230, 0.4);
}

.tdb-activite-timeline {
    position: relative;
    padding-left: 6px;
}

.tdb-activite-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 8px 10px 22px;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.tdb-activite-item:hover {
    background-color: rgba(38, 53, 60, 0.03);
}

[data-theme="sombre"] .tdb-activite-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.tdb-activite-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(38, 53, 60, 0.1);
}

.tdb-activite-item:first-child::before {
    top: 50%;
}

.tdb-activite-item:last-child::before {
    bottom: 50%;
}

[data-theme="sombre"] .tdb-activite-item::before {
    background-color: rgba(255, 255, 255, 0.1);
}

.tdb-activite-item__point {
    position: absolute;
    left: 0;
    top: 18px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--couleur-corail);
    border: 2px solid #ffffff;
    z-index: 1;
}

[data-theme="sombre"] .tdb-activite-item__point {
    border-color: #232a2f;
}

.tdb-activite-item--nouveau .tdb-activite-item__point {
    box-shadow: 0 0 0 3px rgba(255, 103, 106, 0.25);
}

.tdb-activite-item__avatars {
    display: flex;
    flex-shrink: 0;
}

.tdb-activite-item__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--couleur-corail);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    background-size: cover;
    background-position: center;
    border: 2px solid #ffffff;
}

[data-theme="sombre"] .tdb-activite-item__avatar {
    border-color: #232a2f;
}

.tdb-activite-item__avatars .tdb-activite-item__avatar:not(:first-child) {
    margin-left: -12px;
}

.tdb-activite-item__corps {
    flex: 1;
    min-width: 0;
}

.tdb-activite-item__texte {
    font-size: 0.85rem;
    color: var(--couleur-anthracite);
    line-height: 1.4;
}

[data-theme="sombre"] .tdb-activite-item__texte {
    color: #f0ebe6;
}

.tdb-activite-item__date {
    font-size: 0.74rem;
    color: rgba(38, 53, 60, 0.45);
    margin-top: 2px;
}

.tdb-activite-item__badge-nouveau-inline {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--couleur-corail);
    margin-left: 6px;
    vertical-align: middle;
}

.tdb-activite-item__icone {
    flex-shrink: 0;
    font-size: 0.9rem;
    margin-top: 8px;
}

.tdb-activite-voir-plus {
    display: block;
    margin: 16px auto 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--couleur-corail);
}

.tdb-activite-voir-plus[hidden] {
    display: none;
}

/* ==========================================================================
   THÈME SOMBRE — complément (couvre tout ce qui manquait)
   ========================================================================== */

[data-theme="sombre"] .tdb-stat {
    background-color: #232a2f;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="sombre"] .tdb-stat__valeur {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-stat__label {
    color: rgba(240, 235, 230, 0.55);
}

[data-theme="sombre"] .tdb-carte {
    background-color: #232a2f;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="sombre"] .tdb-carte__titre {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-etat-vide__icone {
    background-color: rgba(255, 255, 255, 0.06);
    color: rgba(240, 235, 230, 0.35);
}

[data-theme="sombre"] .tdb-etat-vide__titre {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-etat-vide__texte {
    color: rgba(240, 235, 230, 0.6);
}

[data-theme="sombre"] .tdb-profil {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="sombre"] .tdb-profil__nom {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-profil__role {
    color: rgba(240, 235, 230, 0.55);
}

[data-theme="sombre"] .tdb-profil__membre-depuis,
[data-theme="sombre"] .tdb-profil__derniere-connexion {
    color: rgba(240, 235, 230, 0.45);
}

[data-theme="sombre"] .tdb-completion__label {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-completion__barre {
    background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="sombre"] .tdb-completion__item {
    color: rgba(240, 235, 230, 0.55);
}

[data-theme="sombre"] .tdb-completion__item i {
    color: rgba(240, 235, 230, 0.25);
}

[data-theme="sombre"] .tdb-completion__item--fait {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-securite__cercle-fond {
    stroke: rgba(255, 255, 255, 0.08);
}

[data-theme="sombre"] .tdb-securite__pourcentage {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-securite__item {
    color: rgba(240, 235, 230, 0.55);
}

[data-theme="sombre"] .tdb-securite__item--ok {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-activite-item__texte {
    color: #f0ebe6;
}

[data-theme="sombre"] .tdb-activite-item__date {
    color: rgba(240, 235, 230, 0.45);
}

[data-theme="sombre"] .tdb-mon-histoire-item__meta {
    color: rgba(240, 235, 230, 0.5);
}

[data-theme="sombre"] .tdb-skeleton {
    background-color: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   RESPONSIVE — renforcé, palier mobile serré manquant
   ========================================================================== */

@media (max-width: 900px) {
    .tdb-banniere {
        padding: 22px 20px;
    }

    .tdb-banniere__citation {
        max-width: none;
    }
}

@media (max-width: 640px) {
    .tableau-de-bord {
        padding: 24px 0 56px;
    }

    .tdb-banniere__gauche {
        flex-wrap: wrap;
        gap: 12px;
    }

    .tdb-banniere__avatar {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .tdb-banniere__message {
        font-size: 1rem;
    }

    .tdb-banniere__citation {
        font-size: 0.85rem;
    }

    .tdb-action-icone {
        padding: 12px 10px;
        font-size: 0.7rem;
    }

    .tdb-action-icone i {
        font-size: 1rem;
    }

    .tdb-carte {
        padding: 20px 16px;
    }

    .tdb-carte__titre {
        font-size: 0.98rem;
    }

    .tdb-stat {
        padding: 16px;
        gap: 10px;
    }

    .tdb-stat__icone {
        width: 36px;
        height: 36px;
        font-size: 0.92rem;
    }

    .tdb-stat__valeur {
        font-size: 1.15rem;
    }

    /* Le point de la timeline peut se retrouver trop proche du texte sur
       petite largeur — retire l'indentation dédiée pour gagner de la place */
    .tdb-activite-item {
        padding-left: 18px;
    }

    .tdb-activite-filtres {
        margin: 0 -16px 18px;
        padding: 0 16px 4px;
    }

    .tdb-mon-histoire-item__couverture {
        width: 36px;
        height: 48px;
    }
}

@media (max-width: 380px) {
    .tdb-banniere__actions {
        gap: 6px;
    }

    .tdb-action-icone span {
        display: none;
    }

    .tdb-action-icone {
        padding: 12px;
    }

    .tdb-activite-item__avatar {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }
}

/* ==========================================================================
   RESPONSIVE — passe avancée
   ========================================================================== */

/* Typographie fluide : évite les sauts brusques entre paliers fixes,
   s'ajuste en continu selon la largeur d'écran réelle */
.tdb-banniere__message {
    font-size: clamp(0.95rem, 2.2vw + 0.6rem, 1.1rem);
}

.tdb-stat__valeur {
    font-size: clamp(1.05rem, 1.8vw + 0.7rem, 1.35rem);
}

.tdb-carte__titre {
    font-size: clamp(0.92rem, 1.2vw + 0.75rem, 1.05rem);
}

/* --- Palier tablette (768–900px), absent jusqu'ici — la grille passait
   directement de 2 colonnes à 1 seule sans étape intermédiaire --- */
@media (max-width: 900px) and (min-width: 641px) {
    .tableau-de-bord__grille {
        grid-template-columns: 1fr;
    }

    .tdb-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .tdb-stat {
        padding: 16px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* --- Raffinements mobile (≤640px) --- */
@media (max-width: 640px) {
    /* Jauge de sécurité : passe en colonne plutôt que de comprimer le
       cercle + la liste de critères côte à côte sur une largeur trop étroite */
    .tdb-securite__jauge {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .tdb-securite__lien {
        margin-left: 0;
    }

    /* Complétion de profil : la barre de progression garde une hauteur
       tactile confortable même sur petit écran */
    .tdb-completion__barre {
        height: 10px;
    }

    /* Timeline d'activité : réduit la pile d'avatars groupés qui peut
       devenir dense sur mobile, 2 visibles maximum au lieu de 3 */
    .tdb-activite-item__avatars .tdb-activite-item__avatar:nth-child(n+3) {
        display: none;
    }

    .tdb-activite-item__avatar {
        width: 28px;
        height: 28px;
        font-size: 0.68rem;
    }

    /* Empêche tout débordement horizontal accidentel sur les titres longs
       d'histoires ou de chapitres dans les listes */
    .tdb-mon-histoire-item__titre,
    .tdb-activite-item__texte {
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }

    /* Zone tactile agrandie sur les filtres d'activité, plus confortable au doigt */
    .tdb-activite-filtre {
        padding: 8px 14px;
    }
}

/* --- Très petits écrans (≤340px, ex: anciens iPhone SE) --- */
@media (max-width: 340px) {
    .tdb-stats {
        grid-template-columns: 1fr 1fr;
    }

    .tdb-banniere__avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .tdb-action-icone {
        padding: 10px 8px;
    }
}

/* --- Zone de sécurité tactile en bas d'écran sur mobile avec encoche
   (iPhone avec Dynamic Island/notch) --- */
@media (max-width: 640px) {
    .tableau-de-bord {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

/* --- Respect des préférences d'accessibilité système : désactive les
   animations pour les utilisateurs ayant demandé "réduire les animations"
   dans les réglages de leur appareil, sans rien casser visuellement --- */
@media (prefers-reduced-motion: reduce) {
    .tdb-banniere,
    .tdb-stats > *,
    .tableau-de-bord__grille > *,
    .tdb-skeleton,
    .tdb-completion,
    .tdb-securite,
    .tdb-action-icone,
    .tdb-completion__remplissage,
    .tdb-securite__cercle-progression {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   CORRECTIF DÉBORDEMENT HORIZONTAL — "Mes histoires", "Reprendre ma lecture",
   "Activité récente"
   ========================================================================== */

/* Cause racine : un item de grille/flex a une largeur minimale implicite
   (min-width: auto) qui l'empêche de se réduire sous la largeur de son
   contenu intrinsèque, même si son parent devient plus étroit. Sans
   min-width: 0 explicite sur TOUTE la chaîne de conteneurs, le contenu le
   plus large (badges, piles d'avatars, lignes de texte) force un
   débordement horizontal de la page entière sur mobile. */
.tableau-de-bord__grille > div,
.tdb-carte,
.tdb-mes-histoires-liste,
.tdb-mon-histoire-item,
.tdb-activite-timeline,
.tdb-activite-item {
    min-width: 0;
}

/* Empêche les lignes "Mes histoires"/"Reprendre ma lecture" de forcer une
   largeur trop grande sur mobile : le badge de statut peut passer à la
   ligne suivante plutôt que de repousser le reste hors de l'écran */
@media (max-width: 480px) {
    .tdb-mon-histoire-item {
        flex-wrap: wrap;
    }

    .tdb-mon-histoire-item__badge {
        margin-left: auto;
    }

    .tdb-mon-histoire-item__meta {
        white-space: normal;
        word-break: break-word;
    }
}

/* Filet de sécurité global : empêche tout débordement horizontal résiduel
   de faire apparaître une barre de défilement sur toute la page, quelle
   que soit la cause exacte */
.tableau-de-bord {
    overflow-x: hidden;
}

.tdb-trophees-apercu {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(38, 53, 60, 0.08);
}

[data-theme="sombre"] .tdb-trophees-apercu {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.tdb-trophees-apercu__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tdb-trophees-apercu__titre {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--couleur-anthracite);
    display: flex;
    align-items: center;
    gap: 6px;
}

[data-theme="sombre"] .tdb-trophees-apercu__titre {
    color: #f0ebe6;
}

.tdb-trophees-apercu__titre i {
    color: var(--couleur-corail);
}

.tdb-trophees-apercu__lien {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--couleur-corail);
}

.tdb-trophees-apercu__compteur {
    font-size: 0.78rem;
    color: rgba(38, 53, 60, 0.5);
    margin-bottom: 12px;
}

[data-theme="sombre"] .tdb-trophees-apercu__compteur {
    color: rgba(240, 235, 230, 0.5);
}

.tdb-trophees-apercu__icones {
    display: flex;
    gap: 8px;
}

.tdb-trophee-mini {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.9rem;
}

.tdb-trophee-mini--bronze { background-color: #cd7f32; }
.tdb-trophee-mini--argent { background-color: #9ca3af; }
.tdb-trophee-mini--or { background-color: #d4af37; }

.tdb-trophees-apercu__vide {
    font-size: 0.78rem;
    color: rgba(38, 53, 60, 0.4);
    font-style: italic;
}

[data-theme="sombre"] .tdb-trophees-apercu__vide {
    color: rgba(240, 235, 230, 0.4);
}