/* ============================================================
   Demo Core — Variables, reset, sidebar, layout, topbar
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Couleurs, ombres, rayons, polices, mouvement, colonne latérale : public/css/woopets-tokens.css,
   recopiée dans le <head> de la page (layout/_brand_head.twig). Plus de bloc :root ici. */

/* [V2-SKIN] Tokens du redesign V2 « Atelier-iOS ». Bloc d'override scopé : redéfinit un
   sous-ensemble des radii existants + ajoute les tokens --v2-* (densité, hairline, materials,
   grands titres, élévation). N'altère JAMAIS les couleurs de marque (--c-*). Le :root global
   (desktop / iframe embed) reste intact. Pas de fallback var(--x, #hex) (cf. CLAUDE.md). */
body.v2-skin {
    /* Radius iOS (un cran plus rond) — surcharge les radii consommés par les composants */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;

    /* Densité tactile */
    --v2-gap-tight: 8px;
    --v2-gap: 12px;
    --v2-pad-card: 14px;
    --v2-touch: 44px;

    /* Hairline iOS — double déclaration : fallback 1px d'abord (vieux WebView Android sans
       color-mix gardent celui-ci), puis 0.5px color-mix si supporté */
    --v2-hairline: 1px solid var(--c-border-light);
    --v2-hairline: 0.5px solid color-mix(in srgb, var(--c-text) 8%, transparent);

    /* Materials (barres translucides) — blur autorisé web mobile uniquement (T3), fond
       opaque teinté en shell (le code woopets-shell coupe backdrop-filter pour le GPU) */
    --v2-blur: saturate(180%) blur(20px);
    --v2-mat-bg: rgba(250, 250, 247, 0.72);
    --v2-mat-bg-strong: rgba(250, 250, 247, 0.86);

    /* Grands titres (Fraunces déjà chargée via --f-display) */
    --v2-title-size: clamp(1.55rem, 6vw, 2rem);
    --v2-title-weight: 600;

    /* Élévation carte douce */
    --v2-shadow-card: 0 1px 2px rgba(10, 30, 20, 0.04), 0 8px 24px rgba(10, 30, 20, 0.06);
}

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--f-body);
    color: var(--c-text);
    background: var(--c-bg);
    overflow: hidden;
}

/* Fenêtres dont la feuille arrive en DIFFÉRÉ (demo-auth, demo-settings, demo-training) : ce sont
   des enfants du <body> posés après le pied de page. Sans cette règle, le temps que leur feuille
   arrive, elles prenaient leur place dans la colonne du body — la page se tassait, puis se
   relâchait d'un coup : CLS 1,13 mesuré à froid en production le 23/11/2026 (le chat et le pied
   de page sautaient). Elles s'affichent par .active, règle de leur propre feuille. */
.settings-modal-overlay:not(.active),
.auth-modal-overlay:not(.active),
.account-menu-overlay:not(.active),
.training-rating-overlay:not(.active) { display: none; }

/* Layout wrapper : sidebar + main en row, footer en frere apres (flex column sur body) */
.demo-layout {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR — Light ivoire (woopets.fr aligned)
   ============================================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
    opacity: 0;
    transition: opacity var(--dur-normal) var(--ease-out);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.demo-sidebar {
    width: var(--sidebar-width);
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--c-bg-sidebar);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    z-index: 50;
    transition: transform var(--dur-normal) var(--ease-out);
}

/* STRATE 1 — Header (flex-shrink:0) : marque + fermeture mobile + CTA */
.sidebar-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 0.6rem 0.55rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
}

/* Bouton de fermeture — mobile uniquement (desktop : sidebar permanente) */
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.sidebar-close-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--sidebar-text);
}

.sidebar-brand svg {
    height: 22px;
    width: auto;
}

.sidebar-brand-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: var(--c-primary);
    padding: 0.12rem 0.4rem;
    border-radius: var(--r-xs);
    letter-spacing: 0.06em;
}

/* CTA « Nouvelle conversation » pleine largeur (remplace l'ancien "+" icône-seule) */
.sidebar-new-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.4rem; /* respire sous le logo (s'ajoute au gap 0.5rem du header) */
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--c-primary-soft);
    border-radius: var(--r-sm);
    background: var(--c-primary);
    color: var(--c-text-inverse);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur-fast), transform var(--dur-fast);
}

.sidebar-new-cta svg { flex-shrink: 0; }
.sidebar-new-cta:hover { background: var(--c-primary-hover); }
.sidebar-new-cta:active { transform: scale(0.99); }

/* STRATE 2 — Body : unique zone scrollable (les conversations dominent).
   Bloc simple (pas un flex column) : sinon les enfants flex-shrink:1 se feraient
   comprimer/tronquer au lieu de laisser le body scroller quand le contenu déborde. */
.sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-conversations {
    padding: 0.5rem 0;
}

.sidebar-group {
    padding: 0 0.5rem;
}

.sidebar-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-muted);
    padding: 0.75rem 0.5rem 0.25rem;
}

.sidebar-conv-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem;
    margin: 1px 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast), border-left-color var(--dur-fast);
    position: relative;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    color: var(--sidebar-text);
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.35;
}

.sidebar-conv-item:hover {
    background: var(--sidebar-hover);
}

.sidebar-conv-item.active {
    background: var(--sidebar-active);
    border-left-color: var(--c-primary-soft);
}

.conv-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.conv-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton "⋯" par conversation → ouvre le menu contextuel (rename/pin/archive/delete).
   L'espace (24px + gap) est réservé en permanence (opacity, pas display) : basculer
   display:none → flex au :hover comprimait le titre → layout shift visible. */
.conv-item-menu-btn {
    display: flex;
    opacity: 0;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--r-xs);
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
}

.sidebar-conv-item:hover .conv-item-menu-btn,
.conv-item-menu-btn:focus-visible {
    opacity: 1;
}

.conv-item-menu-btn:hover {
    color: var(--sidebar-text);
    background: rgba(24, 79, 82, 0.1);
}

/* Menu contextuel de conversation (singleton position:fixed appende au body) */
.conv-menu {
    display: none;
    position: fixed;
    z-index: 9600;
    min-width: 185px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    padding: 0.3rem;
}

.conv-menu.open {
    display: block;
}

.conv-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--c-text);
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background var(--dur-fast);
}

.conv-menu-item:hover {
    background: var(--c-bg);
}

.conv-menu-item svg {
    flex-shrink: 0;
}

.conv-menu-item.danger {
    color: var(--c-danger);
}

.conv-menu-item.danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* Renommage inline dans l'item de sidebar */
.conv-rename-input {
    width: 100%;
    border: 1px solid var(--c-primary-soft);
    border-radius: var(--r-xs);
    padding: 2px 6px;
    font-size: 0.84rem;
    font-family: inherit;
    line-height: 1.35;
    color: var(--c-text);
    background: var(--c-bg-card);
    outline: none;
}

/* Anti-zoom iOS : les inputs < 16px declenchent un zoom au focus */
@supports (-webkit-touch-callout: none) {
    .conv-rename-input {
        font-size: 16px;
    }
}

/* Acces a la vue archivee (bas de la liste) */
.sidebar-archived-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: calc(100% - 1rem);
    margin: 0.5rem 0.5rem 0.25rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--sidebar-text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.sidebar-archived-btn:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

/* Header de la vue archivee (retour + titre) */
.sidebar-archived-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.5rem 0.25rem;
}

.sidebar-archived-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.sidebar-archived-back:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.sidebar-archived-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sidebar-text);
}

/* Status dot : streaming en cours OU reponse non-lue */
.conv-item-status {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 2px;
}
.sidebar-conv-item.streaming .conv-item-status {
    background: var(--c-primary-soft);
    box-shadow: 0 0 0 0 rgba(72, 181, 168, 0.55);
    animation: sidebar-conv-pulse 1.4s ease-out infinite;
}
.sidebar-conv-item.unread .conv-item-status {
    /* Corail Unique v2 (ADO-1) : marqueur d'état, pas un chemin vers l'IA — teal. */
    background: var(--c-primary-soft);
}
@keyframes sidebar-conv-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(72, 181, 168, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(72, 181, 168, 0); }
    100% { box-shadow: 0 0 0 0 rgba(72, 181, 168, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar-conv-item.streaming .conv-item-status {
        animation: none;
        box-shadow: 0 0 0 2px rgba(72, 181, 168, 0.35);
    }
}

/* Etat grise pour les actions bloquees pendant un envoi/streaming.
 * Volontairement sans `pointer-events: none` : on laisse le clic passer
 * pour que la garde dans newConversation/deleteConversation puisse afficher
 * le toast d'explication (sinon l'user clique dans le vide sans feedback). */
.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.is-disabled:hover {
    background: transparent !important;
    color: inherit !important;
}

.sidebar-empty {
    padding: 2.5rem 1rem;
    text-align: center;
}
/* [V1.6] Empty state riche (clone de .pet-list-empty) — fond teal de la sidebar →
   var(--sidebar-text*) (PAS var(--c-text*), sinon texte quasi invisible). */
.sidebar-empty-icon {
    color: var(--sidebar-text-muted);
    opacity: 0.35;
    margin-bottom: 0.75rem;
}
/* Inter, pas Fraunces : un état vide n'est ni un expert ni un moment de marque
   (Règle de la Signature, DESIGN.md). */
.sidebar-empty-text {
    font-family: var(--f-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--sidebar-text);
    margin-bottom: 0.35rem;
}
.sidebar-empty-sub {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--sidebar-text-muted);
}

/* ---- Sidebar pets section ---- */

/* Section animaux — repliable (<details>), ÉLEVÉE en tête du corps (avant les
   conversations) pour pousser l'ajout. border-bottom (et non -top) : elle se sépare
   des conversations en dessous, sans doublonner le border-bottom du header au-dessus.
   Plus de max-height/overflow propre : c'est .sidebar-body qui scrolle désormais. */
.sidebar-pets-section {
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(24, 79, 82, 0.03);
    padding: 0.25rem 0.5rem 0.5rem;
}

.sidebar-pets-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-text-muted);
    padding: 0 0.35rem 0.3rem;
}

.sidebar-pet-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.35rem;
    border-radius: var(--r-8);
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    font-family: inherit;
    cursor: pointer;
    transition: background var(--dur-fast);
    text-align: left;
}

.sidebar-pet-item:hover {
    background: var(--sidebar-hover);
}

.sidebar-pet-avatar {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.sidebar-pet-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-pet-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.sidebar-pet-breed {
    font-size: 0.68rem;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.sidebar-pet-add-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.3rem 0.35rem;
    margin-top: 0.15rem;
    border-radius: var(--r-8);
    border: none;
    background: transparent;
    color: var(--sidebar-text-muted);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    transition: color var(--dur-fast), background var(--dur-fast);
}

.sidebar-pet-add-btn:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover);
}

/* STRATE 3 — Footer compte (flex-shrink:0 + safe-area iOS).
   Pas de fond distinct : il reprend le fond de la sidebar (séparation via la
   bordure haute) — un fond blanc jurait avec le teal du reste du menu. */
.sidebar-bottom {
    flex-shrink: 0;
    border-top: 1px solid var(--sidebar-border);
    padding: 0.5rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
}

.sidebar-delete-all-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem;
    padding: 0.6rem;
    border-radius: var(--r-sm);
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-delete-all-btn:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--c-danger);
}

.sidebar-delete-all-btn svg {
    flex-shrink: 0;
}

.sidebar-settings-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem;
    border-radius: var(--r-sm);
    color: var(--sidebar-text);
    font-size: 0.84rem;
    font-family: inherit;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--dur-fast);
}

.sidebar-settings-btn:hover {
    background: var(--sidebar-hover);
}

/* Paramètres (langue + usage) désormais accessible à TOUS, anonymes inclus :
   l'ancien mask `body.is-anon .sidebar-settings-btn { display:none }` est retiré
   (le sélecteur de langue vit aussi dans le <details> « Plus » ci-dessous). */

/* ---- « Plus » : disclosure repliée (langue + liens légaux + copyright) ----
   Masquée sur desktop : le footer global pleine largeur (sous le chat) porte
   déjà langue + liens légaux → on évite la redondance. Visible mobile seulement
   (le footer global y est masqué, cf. media query mobile). */
.sidebar-more {
    display: none;
    margin-top: 2px;
    border-top: 1px solid var(--sidebar-border);
    padding-top: 2px;
}

.sidebar-more-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0.5rem;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sidebar-text-muted);
    transition: background var(--dur-fast);
}
.sidebar-more-summary::-webkit-details-marker { display: none; }
.sidebar-more-summary:hover { background: var(--sidebar-hover); }

.sidebar-more-caret {
    color: var(--sidebar-text-muted);
    transition: transform var(--dur-fast);
}
.sidebar-more[open] .sidebar-more-caret { transform: rotate(180deg); }

.sidebar-more-panel {
    padding: 0.35rem 0.5rem 0.5rem;
}

/* Sélecteur de langue — grille 5 colonnes lisible (vs 11px tassés du footer fixe supprimé) */
.sidebar-lang {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.6rem;
}

.sidebar-lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.4rem 0.15rem;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--sidebar-text-muted);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.sidebar-lang-btn:hover {
    background: var(--sidebar-hover);
    color: var(--c-primary);
}

.sidebar-lang-btn.active {
    background: var(--c-primary);
    color: var(--c-text-inverse);
}

.sidebar-lang-btn span[aria-hidden] { font-size: 1rem; line-height: 1; }

.sidebar-legal-links {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

/* Une colonne : évite le wrap des libellés FR longs (« Politique de
   confidentialité ») dans le drawer étroit, et donne des rangées tactiles. */
.sidebar-legal-links a {
    display: block;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.76rem;
    line-height: 2.1;
    transition: color var(--dur-fast);
}

.sidebar-legal-links a:hover {
    color: var(--c-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sidebar-copy {
    margin: 0;
    font-size: 0.7rem;
    color: var(--sidebar-text-muted);
}

/* ---- User section: row + popover ---- */

.sidebar-user-section {
    margin-bottom: 4px;
    position: relative;
}

.sidebar-user-section:empty {
    margin-bottom: 0;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast);
    width: 100%;
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    font-family: inherit;
    text-align: left;
}

.user-row:hover {
    background: var(--sidebar-hover);
}

.user-avatar-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--c-primary);
    color: white;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
    overflow: hidden;
}

/* Avatar central (D3, plan compte central) : photo de profil dans la pastille sidebar */
.user-avatar-small .user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-row-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-chevron {
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
    transition: transform var(--dur-fast);
}

.user-row.popover-open .user-row-chevron {
    transform: rotate(180deg);
}

/* Popover above the user row */
.user-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 60;
    animation: popoverIn var(--dur-normal) var(--ease-spring);
}

.user-popover.open {
    display: block;
}

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

.user-popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--r-sm);
    color: var(--c-text);
    font-size: 0.82rem;
    font-family: inherit;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--dur-fast);
}

.user-popover-item:hover {
    background: var(--c-bg-warm);
}

.user-popover-item.danger {
    color: var(--c-danger);
}

.user-popover-item.danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.user-popover-divider {
    height: 1px;
    background: var(--c-border-light);
    margin: 3px 0;
}

/* Login button for non-authenticated */
.user-register-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    margin-bottom: 4px;
    border-radius: var(--r-sm);
    /* Vocabulaire « soumission » (Encre → hover teal) : le corail vif est réservé
       au bouton d'envoi — Règle du Corail Unique (DESIGN.md). */
    background: var(--c-text);
    color: var(--c-text-inverse);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--dur-fast);
}

.user-register-btn svg { flex-shrink: 0; }

.user-register-btn:hover { background: var(--c-primary); }

.user-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem;
    border-radius: var(--r-sm);
    /* Teal lisible (AA ≥ 4,5:1) : la pêche ne passe pas en texte sur fond teinté (1,6:1). */
    color: var(--c-primary);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--dur-fast);
}

.user-login-btn:hover {
    background: var(--sidebar-hover);
}

/* ============================================================
   MAIN AREA
   ============================================================ */

.demo-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

/* Clavier du shell iOS (OTA) : la WKWebView reste plein écran pour que le clavier
   translucide voie toujours le DOM clair, jamais le UIWindow natif. VisualViewport
   fournit la seule hauteur visible ; aucune transition afin de suivre l'animation iOS. */
@media (max-width: 767px) {
    body.woopets-shell.keyboard-open .demo-main {
        height: var(--woo-visual-viewport-height, 100%);
        transform: translateY(var(--woo-visual-viewport-top, 0px));
        transition: none;
    }
}

/* [V3.1/V3.2] Bottom tab bar — responsive partagé (web mobile + app), JAMAIS desktop ni embed.
   En flux flex (dernier enfant de .demo-main), pas position:fixed. Translucide+blur web mobile,
   opaque en shell (perf GPU). hidden statique + révélation JS (W.revealTabbar). */
.app-tabbar { display: none; }
@media (max-width: 767px) {
    .app-tabbar:not([hidden]) {
        /* Grille à TROIS zones, pas une rangée d'onglets égaux : Oria reste exactement au
           centre même quand l'onglet Village est absent (DM18, lot B2c). */
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: stretch;
        flex-shrink: 0;
        border-top: 1px solid var(--c-border-light);
        background: rgba(250, 250, 247, 0.92);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        position: relative;
        z-index: 20;
    }
    .app-tab-group { display: flex; min-width: 0; }
    .app-tab-center { display: flex; }
    /* Un onglet [hidden] (clic/news, révélés par leurs init shell/FR) doit rester masqué :
       sans cette règle, .app-tab{display:flex} (auteur) écrase le [hidden] de l'UA → l'onglet
       Clics apparaissait sur le web mobile alors qu'il est app-only. */
    .app-tab[hidden] { display: none; }
    .app-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 52px;
        padding: 6px 4px;
        border: none;
        background: transparent;
        color: var(--c-text-muted);
        cursor: pointer;
        position: relative;
        transition: color var(--dur-fast);
        /* Supprime le carré gris/translucide de tap natif WebKit au clic (mobile). */
        -webkit-tap-highlight-color: transparent;
    }
    .app-tab-icon {
        width: 24px;
        height: 24px;
    }
    /* Un libellé d'onglet tient sur UNE ligne, toujours : c'est ce qui garantit que les
       icônes restent alignées d'un onglet à l'autre. Sans cette règle, un libellé long
       (FR « Clics Solidaires », DE « Adoptieren » sur un 320 px) se replie sur deux lignes
       et pousse SON icône vers le haut — l'onglet paraît décalé par rapport à ses voisins.
       En dernier recours le texte est tronqué (…) plutôt que replié : une troncature reste
       lisible et alignée, un repli casse la rangée. */
    .app-tab-label {
        font-size: 0.72rem;
        font-weight: 550;
        line-height: 1.25;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Onglets plats de la maquette (DM18, lot B2c) : l'actif se dit par le teal, sans pastille.
       Oria est un onglet comme les autres, au centre : le corail reste au seul bouton d'envoi
       (« un seul corail par écran »). Sa largeur rejoint celle des autres (un cinquième). */
    .app-tab.active { color: var(--c-primary); }
    .app-tab.active .app-tab-label { font-weight: 650; }
    .app-tab--ai { width: 20vw; max-width: 96px; }
    .app-tab:active .app-tab-icon { transform: scale(0.92); }

    .app-tab-dot {
        position: absolute;
        top: 5px;
        left: 50%;
        margin-left: 6px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        /* Corail Unique v2 (ADO-1) : le corail signifie « un chemin vers l'IA ». Une
           pastille de nouveauté n'en est pas un — teal. */
        background: var(--c-primary-soft);
    }
    /* La barre porte la zone sûre du bas : la zone de saisie n'en a plus besoin. */
    body.has-tabbar .demo-input-area { padding-bottom: 10px; }
    /* Mobile (tab bar active) : le nom + popover compte de la sidebar fait doublon avec le
       menu compte derrière l'avatar de la topbar (#topbarAccountBtn) → on le masque. La
       sidebar devient un historique pur ; compte/déconnexion/langue vivent dans le menu compte. */
    body.has-tabbar .sidebar-user-section { display: none; }
    /* Idem pour Paramètres / Accueil / Actus : redondants sur mobile (Réglages vit dans
       l'onglet Profil ; Accueil est un onglet, et les Actus sont dans l'Accueil). Gardé sur
       desktop (has-tabbar est aussi posé sur desktop → @media obligatoire). Seuls les liens
       légaux (« Plus ») restent dans la sidebar mobile.
       [REFONTE-ENTREE] `.sidebar-clic-entry` N'EST PLUS masquée : Clics solidaires a quitté
       la tab bar (remplacée par Profil), la sidebar redevient donc un de ses accès — avec le
       bouton topbar dédié — jusqu'à l'entrée Accueil du lot suivant. La retirer d'ici sans
       cette bascule rendrait la feature inatteignable sur mobile. */
    body.has-tabbar .sidebar-settings-btn,
    body.has-tabbar .sidebar-explore-btn,
    body.has-tabbar .sidebar-news-entry { display: none; }
    /* Clavier : masquer la barre (input remonte). keyboard-open = shell (T8) ; input-focused
       = filet web mobile (focus textarea → clavier monte). */
    body.keyboard-open .app-tabbar,
    body.input-focused .app-tabbar { display: none; }
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    @media (max-width: 767px) {
        body:not(.woopets-shell) .app-tabbar:not([hidden]) {
            background: rgba(250, 250, 247, 0.82);
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
        }
    }
}

/* [V3.5] Avatar compte topbar — mobile-only (révélé par revealTabbar ; CSS le garde < 768px). */
.topbar-account-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--c-text-secondary);
    cursor: pointer;
    border-radius: var(--r-full);
}
@media (max-width: 767px) {
    .topbar-account-btn:not([hidden]) { display: flex; }
    /* [V3.5b] L'icône liste (historique conversations) n'apparaît que sur l'onglet Chat quand la
       tab bar est active ; sur les autres onglets le back/contexte prend le relais. */
    body.has-tabbar:not(.tab-chat) .topbar-menu-btn { display: none; }
}

/* [ONBOARDING-V2] Six écrans révélés par le bridge (demo-native.js) au 1er lancement de
   l'app. Inerte hors shell (élément hidden, jamais révélé sur web/embed).
   Chaque écran montre un FRAGMENT D'UI RÉELLE dans une fenêtre (.ob-win) posée sur une
   bande teintée : les classes ob-* recopient volontairement les composants d'origine
   (.ado-card, .agent-intro-card, .nutrition-card, .health-event, .clic-camp-card) plutôt
   que de les importer — l'onboarding doit rester autonome et sans dépendance de chargement
   (il s'affiche AVANT le hide du splash, donc avant les CSS lazy). Si un de ces composants
   change de look, repasser ici. */
.app-onboarding {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: var(--c-bg);
    display: flex;
    flex-direction: column;
}
/* CRITIQUE : respecter l'attribut hidden (sinon .app-onboarding{display:flex} l'écrase et
   l'écran s'affiche sur desktop/web). Révélé UNIQUEMENT par le bridge app (initOnboarding). */
.app-onboarding[hidden] { display: none; }
.app-onboarding-pages {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-height: 0;
    /* Le geste ne doit pas déborder sur l'historique de la WebView ni sur la vue dessous. */
    overscroll-behavior-x: contain;
}
.app-onboarding-pages::-webkit-scrollbar { display: none; }
.app-onboarding-page {
    flex: 0 0 100%;
    width: 100%;
    /* `start` + `stop: always` : `center` laissait un geste rapide s'arrêter entre deux
       écrans (défaut de recette du 26/08). `always` interdit aussi de sauter un écran. */
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --- Scène : bande teintée + fenêtre de démo --- */
.ob-stage {
    position: relative;
    /* flex: 0 1 auto — la scène CÈDE sa hauteur quand le texte en demande plus (titre sur
       trois lignes dans une autre langue, petit écran). Sans ça, la dernière ligne du
       paragraphe passait sous les pastilles. La fenêtre suit (height:100%) et rogne un peu
       plus sa démo, ce qu'elle sait faire (fondu de bas). */
    flex: 0 1 auto;
    min-height: 260px;
    /* clamp : sur un petit écran (SE, paysage) la scène cède la place au texte et au bouton,
       la fenêtre se contente de rogner sa démo (elle a déjà son fondu de bas). */
    height: clamp(330px, 58vh, 496px);
    display: flex;
    align-items: center;
    justify-content: center;
    /* La hauteur du bouton « Passer » est RÉSERVÉE ici : il est positionné à
       max(16px, safe-area-top), donc il descend avec l'encoche et venait se poser sur la
       fenêtre de démo (défaut de recette du 26/08). */
    padding: calc(max(16px, env(safe-area-inset-top, 0px)) + 46px) 24px 24px;
    box-sizing: border-box;
}
.ob-band {
    position: absolute;
    inset: 0;
    border-radius: 0 0 30px 30px;
    overflow: hidden;
}
.ob-band--sand { background: var(--c-accent-soft); }
.ob-band--wash { background: var(--c-primary-light); }
.ob-band--deep { background: var(--c-bg-warm); }
.ob-band--peach { background: var(--c-accent-light); }
.ob-band--teal { background: var(--c-primary); }
.ob-band-paw { position: absolute; color: #fff; display: block; }
.ob-band-paw svg { display: block; width: 100%; height: 100%; }
.ob-band-paw--a { top: 84px; left: -18px; width: 120px; height: 120px; opacity: 0.10; }
.ob-band-paw--b { bottom: -12px; right: -18px; width: 152px; height: 152px; opacity: 0.08; }
.ob-win {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 412px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(10, 30, 20, 0.16), 0 3px 6px rgba(10, 30, 20, 0.05);
    padding: 14px;
    box-sizing: border-box;
    overflow: hidden;
}
.ob-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30px;
    background: linear-gradient(180deg, rgba(250, 250, 247, 0) 0%, var(--c-bg) 80%);
    pointer-events: none;
}

/* --- Texte + pied commun --- */
.ob-copy { flex-shrink: 0; padding: 22px 28px 0; }
.ob-kick {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--c-primary);
}
.ob-title {
    margin: 8px 0 0;
    font-family: var(--f-display);
    font-style: italic;
    font-size: clamp(1.35rem, 5.6vw, 1.62rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.01em;
    color: var(--c-text);
}
.ob-text {
    margin: 12px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--c-text-secondary);
}
.ob-foot {
    flex-shrink: 0;
    padding: 16px 24px max(20px, env(safe-area-inset-bottom, 0px));
}
.ob-cta {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--r-full);
    background: var(--c-primary);
    color: var(--c-text-inverse);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ob-cta:disabled { opacity: 0.7; cursor: default; }
.ob-later {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 13px 16px 0;
    border: none;
    background: transparent;
    color: var(--c-text-muted);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    cursor: pointer;
}
/* Masqué SANS quitter le flux : le montrer/cacher changeait la hauteur du pied, donc celle
   du conteneur pagé — un reflow au milieu du geste, et le défilement se calait entre le
   5e et le 6e écran (défaut de recette du 26/08). Le bouton réserve sa place partout, ce qui
   fige aussi la position du bouton principal d'un écran à l'autre. */
.ob-later.is-off { visibility: hidden; pointer-events: none; }
.app-onboarding-skip {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 18px;
    z-index: 3;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--c-text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.app-onboarding-skip.is-off { visibility: hidden; pointer-events: none; }
/* Écran 5 : la bande est teal pleine — le « Passer » doit rester lisible dessus. */
.app-onboarding.on-dark .app-onboarding-skip { color: rgba(255, 255, 255, 0.75); }
.app-onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    padding: 0 0 16px;
}
.app-onboarding-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-border);
    transition: width var(--dur-fast), background var(--dur-fast);
}
.app-onboarding-dot.active {
    width: 20px;
    border-radius: 4px;
    background: var(--c-primary);
}

/* --- Démo 1 : grille d'adoption (recopie .ado-*) --- */
.ob-ado-bar { display: flex; gap: 7px; overflow: hidden; }
.ob-ado-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    background: var(--c-bg-card);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.ob-ado-chip.is-on { background: var(--c-primary); color: var(--c-text-inverse); border-color: var(--c-primary); }
.ob-ado-count { margin: 10px 2px 8px; font-size: 0.78rem; color: var(--c-text-secondary); }
.ob-ado-count strong { color: var(--c-text); font-weight: 700; }
.ob-ado-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ob-ado-card {
    display: flex;
    flex-direction: column;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
}
.ob-ado-photo {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Aplats de repli des vraies cartes d'annonce (demo-adoption.css). */
.ob-ph0 { background: linear-gradient(140deg, #e3eeea 0%, #b8e0d8 100%); }
.ob-ph1 { background: linear-gradient(140deg, #fcf0e9 0%, #f7d3b8 100%); }
.ob-ph2 { background: linear-gradient(140deg, #eef3f0 0%, #cfe3df 100%); }
.ob-ph3 { background: linear-gradient(140deg, #fae4d7 0%, #f0c9ae 100%); }
.ob-ado-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ob-paw { display: flex; color: rgba(24, 79, 82, 0.16); width: 40px; height: 40px; }
.ob-paw svg { width: 100%; height: 100%; display: block; }
.ob-ado-new {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: var(--r-full);
    background: var(--c-primary-soft);
    color: var(--c-text-inverse);
    font-size: 0.65rem;
    font-weight: 700;
}
.ob-ado-body { display: flex; flex-direction: column; gap: 5px; padding: 9px 10px 11px; min-width: 0; }
.ob-ado-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--c-text);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ob-ado-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ob-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--c-bg-warm);
    color: var(--c-text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.5;
}
.ob-tag--place { background: var(--c-primary-light); color: var(--c-primary); }
.ob-tag--m { background: #e0f2fe; color: #0369a1; }
.ob-tag--f { background: #fce7f3; color: #be185d; }

/* --- Démo 2 : chat + carte d'intro d'agent (recopie .agent-intro-card mobile) --- */
.ob-strip { display: flex; align-items: center; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--c-border-light); }
.ob-strip-avs { display: flex; flex-shrink: 0; }
.ob-strip-avs img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--c-primary-light);
    border: 2px solid var(--c-bg);
}
.ob-strip-avs img + img { margin-left: -9px; }
.ob-strip-txt { font-size: 0.72rem; color: var(--c-text-secondary); line-height: 1.35; }
.ob-chat { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ob-bub-u {
    align-self: flex-end;
    max-width: 88%;
    background: var(--c-bubble-user);
    color: var(--c-bubble-user-text);
    font-size: 0.84rem;
    line-height: 1.45;
    padding: 9px 12px;
    border-radius: 14px 14px 4px 14px;
}
.ob-bub-a {
    align-self: flex-start;
    max-width: 92%;
    background: var(--c-bg);
    border: 1px solid var(--c-border-light);
    color: var(--c-text);
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 9px 12px;
    border-radius: 14px 14px 14px 4px;
}
.ob-intro {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: start;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--r-md);
    padding: 11px 12px;
}
.ob-intro-av {
    grid-row: 1 / span 2;
    grid-column: 1;
    align-self: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--c-primary-light);
    border: 1px solid var(--c-border-light);
}
.ob-intro-name {
    grid-row: 1;
    grid-column: 2;
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 500;
    font-size: 0.94rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--c-text);
}
.ob-intro-role {
    grid-row: 2;
    grid-column: 2;
    margin-top: 2px;
    font-size: 0.69rem;
    color: var(--c-primary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}
.ob-intro-bio {
    grid-row: 3;
    grid-column: 1 / -1;
    margin-top: 7px;
    font-size: 0.76rem;
    color: var(--c-text-secondary);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Démo 3 : card nutrition (recopie .nutrition-*) --- */
.ob-nut {
    position: relative;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 16px;
}
.ob-nut::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--c-primary-soft), var(--c-primary-muted));
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.ob-nut-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ob-nut-av {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--c-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.ob-nut-id { min-width: 0; }
.ob-nut-name { display: block; font-size: 1rem; font-weight: 700; color: var(--c-text); }
.ob-nut-sub { display: block; margin-top: 2px; font-size: 0.8rem; color: var(--c-text-muted); }
.ob-nut-crit { margin-bottom: 12px; }
.ob-nut-lab {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.ob-nut-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* L'emoji est légèrement plus gros que le libellé, comme .nutrition-chip-icon. */
.ob-nut-chip > span { font-size: 14px; }
.ob-nut-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
}
.ob-nut-resh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ob-nut-resh .ob-nut-lab { margin-bottom: 0; }
.ob-nut-arrows { display: flex; gap: 6px; flex-shrink: 0; }
.ob-nut-arrows span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--r-full);
    border: 1px solid var(--c-border);
    background: var(--c-bg-card);
    color: var(--c-text-muted);
    font-size: 0.62rem;
}
.ob-nut-arrows span.is-on { color: var(--c-primary); }
.ob-nut-slider { display: flex; gap: 12px; padding: 6px 0 10px; overflow: hidden; }
.ob-nut-prod {
    flex: 0 0 220px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* 140 px au lieu des 110 px de .nutrition-product-image : un paquet de croquettes est en
   PORTRAIT dans une vignette en paysage (220 px de large) — sous 100 px de haut, on ne voit
   plus le produit. La hauteur vient du bloc « critères détectés », retiré du markup : sa
   personnalisation (senior, 24 kg) est déjà dite par la ligne sous le nom de l'animal. */
.ob-nut-img {
    width: 100%;
    height: 160px;
    background: var(--c-bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ob-nut-img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.ob-nut-brand {
    font-size: 0.68rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.ob-nut-brand.is-pref { color: var(--c-success); }
/* Deux lignes maxi, comme .nutrition-product-name : un nom de produit long poussait les
   raisons « ✓ » hors de la fenêtre — or c'est ce que le titre de l'écran promet. */
.ob-nut-pname {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ob-nut-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ob-nut-tag { font-size: 0.68rem; padding: 2px 6px; background: var(--c-bg-warm); color: var(--c-text-secondary); border-radius: 4px; }
.ob-nut-fits { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.ob-nut-fit {
    font-size: 0.62rem;
    line-height: 1.3;
    padding: 2px 6px;
    background: rgba(22, 163, 74, 0.08);
    color: var(--c-success);
    border-radius: 4px;
    font-weight: 500;
}
.ob-nut-price { font-size: 0.8rem; font-weight: 700; color: var(--c-primary); }

/* --- Démo 4 : carnet (recopie .carnet-ring + .health-event) --- */
.ob-cv-head { display: flex; align-items: center; gap: 12px; }
.ob-ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.ob-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ob-ring-v {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--c-text);
}
.ob-cv-id { min-width: 0; }
.ob-cv-score { display: block; font-size: 0.86rem; font-weight: 700; color: var(--c-text); }
.ob-cv-score span { color: var(--c-text-muted); font-weight: 600; }
.ob-cv-hint {
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--c-text-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ob-cv-month {
    margin-top: 14px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ob-tl { position: relative; padding-left: 24px; margin-top: 8px; }
.ob-tl::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--c-border-light);
    border-radius: 1px;
}
.ob-ev {
    position: relative;
    margin-bottom: 8px;
    padding: 12px 14px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    gap: 10px;
}
.ob-ev::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--c-border);
    background: var(--c-bg-card);
}
.ob-ev--open { display: block; }
.ob-ev-row { display: flex; align-items: center; gap: 10px; }
.ob-ev-ic {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.ob-ev-info { min-width: 0; flex: 1; }
.ob-ev-title { display: block; font-size: 0.82rem; font-weight: 600; color: var(--c-text); line-height: 1.3; }
.ob-ev-meta { display: flex; gap: 6px; align-items: center; margin-top: 2px; font-size: 0.68rem; color: var(--c-text-muted); }
.ob-ev-verify {
    padding: 1px 7px;
    border-radius: var(--r-full);
    background: var(--c-accent-soft);
    color: var(--c-accent-hover);
    font-size: 0.66rem;
    font-weight: 700;
    white-space: nowrap;
}
.ob-ev-chev { margin-left: auto; color: var(--c-text-muted); display: flex; flex-shrink: 0; }
.ob-ev-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--c-accent-light);
    border: 1px solid var(--c-accent-soft);
    border-radius: 10px;
}
.ob-ev-banner-t { font-size: 0.7rem; color: var(--c-text-secondary); line-height: 1.35; }
.ob-ev-banner-a { display: flex; gap: 6px; }
.ob-ev-ok, .ob-ev-edit { padding: 4px 9px; border-radius: var(--r-sm); font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.ob-ev-ok { background: var(--c-primary); color: var(--c-text-inverse); }
.ob-ev-edit { background: var(--c-bg-card); border: 1px solid var(--c-border); color: var(--c-text-secondary); }

/* --- Démo 5 : campagne solidaire (recopie .clic-camp-*) --- */
.ob-clic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.ob-clic-h1 { font-family: var(--f-display); font-style: italic; font-size: 1.02rem; font-weight: 600; color: var(--c-text); }
.ob-clic-per { font-size: 0.7rem; color: var(--c-text-muted); }
.ob-camp {
    position: relative;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 13px;
    margin-bottom: 11px;
}
.ob-camp-head { display: flex; gap: 11px; margin-bottom: 11px; }
.ob-camp-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ob-camp-logo svg { width: 24px; height: 24px; display: block; }
.ob-camp-body { flex: 1; min-width: 0; }
.ob-camp-name { display: block; font-size: 0.92rem; font-weight: 700; color: var(--c-text); line-height: 1.25; }
.ob-camp-total { display: block; font-size: 1.15rem; font-weight: 700; color: var(--c-primary); line-height: 1.2; margin-top: 1px; }
.ob-camp-total small { font-size: 0.75rem; font-weight: 500; color: var(--c-text-muted); }
.ob-camp-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; color: var(--c-text-muted); margin-top: 3px; }
.ob-camp-desc {
    margin: 0 0 11px;
    font-size: 0.78rem;
    color: var(--c-text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Le seul corail de l'écran, comme dans l'app (règle Corail Unique). */
.ob-camp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--c-accent-vivid);
    border-radius: 10px;
    background: var(--c-bg-card);
    color: var(--c-accent-ink);
    font-size: 0.85rem;
    font-weight: 700;
    box-sizing: border-box;
}

/* --- Démo 6 : bandeaux de notification (pas de fenêtre : ils flottent) --- */
/* Le dernier écran n'a pas de fenêtre de démo (trois bandeaux suffisent) et son pied porte
   DEUX boutons : la scène doit rendre la hauteur qu'elle ne consomme pas, sinon le texte
   passe sous les pastilles. */
.ob-stage--notif { align-items: center; height: clamp(280px, 46vh, 396px); }
.ob-notifs { position: relative; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ob-notif {
    display: flex;
    gap: 11px;
    padding: 11px 13px;
    background: var(--c-bg-card);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(10, 30, 20, 0.16), 0 3px 6px rgba(10, 30, 20, 0.05);
}
.ob-notif-ic { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; background: var(--c-bg-card); }
.ob-notif-b { min-width: 0; flex: 1; }
.ob-notif-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ob-notif-app { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-muted); }
.ob-notif-t { font-size: 0.64rem; color: var(--c-text-muted); flex-shrink: 0; }
.ob-notif-title { display: block; margin-top: 3px; font-size: 0.82rem; font-weight: 600; color: var(--c-text); line-height: 1.3; }
.ob-notif-body { display: block; margin-top: 2px; font-size: 0.77rem; color: var(--c-text-secondary); line-height: 1.4; }

/* Petits écrans : la fenêtre de démo rétrécit d'abord, le texte ensuite. */
@media (max-height: 700px) {
    .ob-copy { padding-top: 18px; }
    .ob-text { font-size: 0.86rem; margin-top: 9px; }
    .ob-foot { padding-top: 12px; }
    .ob-cta { padding: 14px 24px; }
}

/* ---- Topbar ---- */

.demo-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 1.25rem;
    background: rgba(250, 250, 247, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-border-light);
    flex-shrink: 0;
}

/* [V2-SKIN] Topbar « Atelier-iOS » : hairline ; materials (blur renforcé) réservés au WEB
   MOBILE (:not(.woopets-shell)) sous @supports — en shell la topbar reste opaque (#fafaf7,
   cf. body.woopets-shell .demo-topbar) car un backdrop-filter permanent y cause un lag de
   premier tap (bug GPU WebKit documenté). Android web mobile : blur OK (Chrome), fallback
   opaque si @supports faux. [V2.2 + V2.3] */
body.v2-skin .demo-topbar {
    border-bottom: var(--v2-hairline);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    body.v2-skin:not(.woopets-shell) .demo-topbar {
        background: var(--v2-mat-bg);
        -webkit-backdrop-filter: var(--v2-blur);
        backdrop-filter: var(--v2-blur);
    }
}

/* [V2.6 désactivé — décision UX] Les titres de sous-vues (Mes animaux, carnet, profil…)
   s'affichent dans le HEADER (topbar), comme les autres pages (Clics/Actus), pour rester
   cohérent. Le grand titre iOS #petViewLargeTitle reste dans le markup mais n'est jamais
   affiché, et le titre topbar n'est plus masqué en sous-vue (.has-large-title est inerte). */
.view-large-title { display: none; }

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--c-text-secondary);
    cursor: pointer;
    transition: background var(--dur-fast);
}

.topbar-menu-btn:hover {
    background: var(--c-bg-warm);
    color: var(--c-primary);
}

.topbar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text);
    letter-spacing: -0.01em;
}

.topbar-agent-indicator {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-full);
    box-shadow: var(--shadow-xs);
    animation: fadeIn var(--dur-normal) var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.indicator-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.indicator-avatar img,
.indicator-avatar .agent-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.indicator-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.indicator-name {
    font-family: var(--f-display);
    font-size: 0.92rem;
    font-weight: 500;
    font-style: italic;
    color: var(--c-primary);
    white-space: nowrap;
    line-height: 1.15;
    letter-spacing: -0.005em;
    /* Titre de conversation (pattern Claude) : tronquer proprement si long */
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(48vw, 560px);
}

.indicator-role {
    font-size: 0.68rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--c-text-secondary);
    cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast);
}

.topbar-new-btn:hover {
    background: var(--c-bg-warm);
    border-color: var(--c-primary-soft);
    color: var(--c-primary);
}

/* ---- Topbar brand (logo) — montré sur l'écran d'accueil mobile.
   Sur desktop, la sidebar porte déjà le logo, donc il reste masqué. ---- */
.topbar-brand {
    display: none;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.topbar-brand svg {
    height: 24px;
    width: auto;
    display: block;
}

.topbar-brand-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: var(--c-primary);
    padding: 0.12rem 0.4rem;
    border-radius: var(--r-xs);
    letter-spacing: 0.06em;
}

/* ---- Topbar register CTA — visiteur anonyme, écran d'accueil uniquement ---- */
.topbar-register-btn {
    display: none;
    align-items: center;
    padding: 0.42rem 0.9rem;
    border: none;
    border-radius: var(--r-full);
    /* Encre → hover teal : corail réservé au send (Règle du Corail Unique, DESIGN.md). */
    background: var(--c-text);
    color: var(--c-text-inverse);
    font-family: var(--f-body);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur-fast), transform var(--dur-fast);
}

.topbar-register-btn:hover { background: var(--c-primary); }
.topbar-register-btn:active { transform: scale(0.97); }

/* Sur l'écran d'accueil, le bouton "+" est redondant (on est déjà sur un chat vierge). */
body.is-chat-welcome .topbar-new-btn { display: none; }
/* Le CTA d'inscription n'apparaît que pour les anonymes, sur l'écran d'accueil. */
body.is-anon.is-chat-welcome .topbar-register-btn { display: inline-flex; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.6rem 1.2rem;
    border-radius: var(--r-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: white;
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--dur-normal) var(--ease-out), transform var(--dur-normal) var(--ease-out);
}

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

.toast.toast-error { background: var(--c-danger); }
.toast.toast-success { background: var(--c-success); }
.toast.toast-info { background: var(--c-primary); }
.toast.toast-warning { background: var(--c-warning); }

/* ============================================================
   SIDEBAR PETS SECTION
   ============================================================ */

/* La section animaux est un <details> ; .sidebar-pets-title en est le <summary> */
.sidebar-pets-section > summary {
    list-style: none;
    cursor: pointer;
}
.sidebar-pets-section > summary::-webkit-details-marker { display: none; }

.sidebar-pets-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-text-muted);
    padding: 0.5rem 0.35rem;
    min-height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--r-xs);
    transition: background var(--dur-fast);
}

.sidebar-pets-title:hover { background: var(--sidebar-hover); }

.sidebar-pets-title-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-pets-title-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.sidebar-pets-caret {
    color: var(--sidebar-text-muted);
    transition: transform var(--dur-fast);
}

.sidebar-pets-section[open] .sidebar-pets-caret { transform: rotate(180deg); }

.sidebar-pets-list { padding-top: 2px; }

/* Compteur "(N)" accolé au titre quand l'utilisateur a des animaux */
.sidebar-pets-count { font-weight: 600; }

/* État vide RICHE (connecté sans animaux) : bénéfice IA + gros CTA d'ajout.
   Dans le contenu du <details> (pas le summary) → pas d'uppercase hérité. */
.sidebar-pets-benefit {
    margin: 0 0 0.5rem;
    padding: 0 0.35rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--sidebar-text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.sidebar-pets-add-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--r-sm);
    background: var(--c-primary);
    color: var(--c-text-inverse);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur-fast);
}

.sidebar-pets-add-cta svg { flex-shrink: 0; }
.sidebar-pets-add-cta:hover { background: var(--c-primary-hover); }

.sidebar-pets-add-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--r-xs);
    background: var(--sidebar-hover);
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
    border: none;
}

.sidebar-pets-add-icon:hover {
    background: var(--sidebar-active);
    color: var(--c-primary);
}

.sidebar-pet-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--dur-fast);
}

.sidebar-pet-item:hover {
    background: var(--sidebar-hover);
}

.sidebar-pet-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-pet-info {
    flex: 1;
    min-width: 0;
}

.sidebar-pet-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-pet-details {
    font-size: 0.7rem;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-pet-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    opacity: 0;
    transition: opacity var(--dur-fast);
    flex-shrink: 0;
}

.sidebar-pet-item:hover .sidebar-pet-actions {
    opacity: 1;
}

.sidebar-pet-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--r-xs);
    background: var(--sidebar-hover);
    color: var(--sidebar-text-muted);
    border: none;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.sidebar-pet-action-btn:hover {
    background: var(--sidebar-active);
    color: var(--c-primary);
}

.sidebar-pet-action-btn.delete:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--c-danger);
}

.sidebar-pets-empty {
    padding: 10px 8px;
    font-size: 0.78rem;
    color: var(--sidebar-text-muted);
    text-align: center;
}

/* ---- Topbar back button ---- */

.topbar-back-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    background: transparent;
    border: none;
    color: var(--c-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.topbar-back-btn:hover {
    background: var(--c-bg-warm);
    color: var(--c-text);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--c-border);
    border-radius: var(--r-full);
}

.demo-sidebar ::-webkit-scrollbar-thumb {
    background: rgba(24, 79, 82, 0.18);
}

/* ============================================================
   TEXT SELECTION
   ============================================================ */

::selection { background: rgba(24, 79, 82, 0.18); color: var(--c-text); }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

:focus { outline: none; }

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--r-sm);
}

.send-btn:focus-visible { box-shadow: var(--focus-ring); }

.sidebar-conv-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--c-primary);
}

.input-wrapper:has(.main-textarea:focus-visible) {
    border-color: var(--c-primary-soft);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE — Core
   ============================================================ */

/* Tablet (768px–1023px) — sidebar compacte */
@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-width: 220px; }
    .sidebar-brand-text { font-size: 0.8rem; }
    .conv-item-title { font-size: 0.78rem; }
}

/* Mobile (< 768px) — sidebar off-canvas, PLEIN ÉCRAN.
   bottom:0 (et non 96px) : l'ancienne barre légale fixe .site-footer 96px est
   supprimée (cf. site-footer.css) ; le drawer reprend toute la hauteur et le
   légal/langue vit désormais dans le <details> « Plus » du footer compte. */
@media (max-width: 767px) {
    .demo-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: auto;
        transform: translateX(-100%);
    }

    .demo-sidebar.open { transform: translateX(0); }
    .topbar-menu-btn { display: flex; }
    .sidebar-close-btn { display: flex; }

    /* « Plus » visible mobile uniquement (le footer global y est masqué ci-dessous) */
    .sidebar-more { display: block; }

    /* Le footer global pleine largeur n'a pas lieu d'être sur le chat mobile
       (légal désormais dans le drawer). On le masque UNIQUEMENT sur /demo/
       (présence de .demo-layout) ; il reste normal sur /legal/*, /contact/, /about/. */
    /* ~ (sibling) plutôt que body:has(...) : un :has() ancré sur body force
       WebKit à re-matcher à CHAQUE mutation DOM (innerHTML du boot, renders) —
       coûteux sur mobile. Même effet : le footer suit .demo-layout dans le DOM. */
    .demo-layout ~ .site-footer { display: none; }

    /* Le logo remplace le titre sur mobile. Le titre est masqué PAR DÉFAUT
       (pas via une classe) → « Nouvelle conversation » ne peut jamais flasher au
       boot, quel que soit le timing du JS ou l'état du cache Twig. Il ne
       réapparaît que dans les sous-vues (animaux, carnet de santé) via is-subview. */
    .topbar-title { display: none; }
    body.is-subview .topbar-title { display: block; cursor: pointer; }
    body.is-chat-welcome .topbar-brand { display: flex; }

    /* Toast : au-dessus du clavier virtuel */
    .toast-container { bottom: calc(env(safe-area-inset-bottom, 0px) + 4rem); }
}

/* Small mobile (< 480px) */
@media (max-width: 479px) {
    .demo-topbar { padding: 0 0.75rem; }
}

/* Tiny mobile (< 360px) */
@media (max-width: 359px) {
    .topbar-agent-indicator { padding: 0.2rem 0.45rem; gap: 0.35rem; }
    .indicator-name { font-size: 0.72rem; max-width: 44vw; }
    .indicator-role { display: none; }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
    .demo-topbar { min-height: 40px; }
}

/* [V1.4] Sous-vues : glissement latéral iOS (drill-down) sur mobile/app — remplace le fade
   vertical (viewFadeIn/clicViewFadeIn) via une spécificité supérieure (.demo-chat-area .view-*) ;
   desktop (>767px) conserve le fade. reduced-motion neutralise globalement plus bas. */
@keyframes viewSlideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@media (max-width: 767px) {
    .demo-chat-area { overflow-x: clip; }
    .demo-chat-area .view-pet-form,
    .demo-chat-area .view-health-records,
    .demo-chat-area .view-app-clic,
    .demo-chat-area .view-app-news {
        animation: viewSlideInRight 240ms var(--ease-out);
    }
}

/* Touch devices — always show interactive elements */
@media (hover: none) and (pointer: coarse) {
    /* Pas de hover sur tactile → actions animaux toujours visibles (sinon intouchables). */
    .sidebar-pet-actions { opacity: 1; }
    /* Idem : le bouton menu "⋯" de conversation est hover-only (opacity:0 révélé
       au :hover) → intouchable au doigt (web mobile PWA + shell). On le révèle en
       permanence sur tactile. NON gaté shell : doit aussi corriger le PWA web mobile. [V1.1] */
    .conv-item-menu-btn { opacity: 0.6; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================
   [NATIVE-HOOK] Shell Capacitor uniquement — classe posée par demo-native.js.
   La WebView native est plein écran (pas de chrome navigateur Safari) : le
   header et la sidebar doivent dégager l'encoche/Dynamic Island.

   Depuis Capacitor 8, WKWebView propage NATIVEMENT env(safe-area-inset-*) au CSS
   (avec ios.contentInset:'never' + viewport-fit=cover) → var(--wsafe-top, env(...))
   retombe directement sur env() natif. La variable --wsafe-* n'est plus injectée
   par personne (l'injection AppDelegate, requise en Cap 6 où env() renvoyait 0, a
   été retirée à la migration Cap 8) ; var(--wsafe-*, env(...)) ne la garde que
   comme fallback inoffensif. Inerte sur le web (woopets-shell n'y est jamais posée).
   ========================================= */
body.woopets-shell .demo-topbar {
    /* Reproduit la géométrie du site web sous l'encoche : la zone de contenu
       doit faire 56px avec le contenu CENTRÉ (web mesuré : 10px d'air de chaque
       côté). Comme box-sizing:border-box fait entrer le padding dans min-height,
       un simple padding-top > 56px ÉCRASE le centrage : le logo/nom d'agent se
       collait à la bordure basse, tout l'air partait au-dessus. Ici :
       min-height (wsafe + 56) − padding-top (wsafe) = 56px de zone de contenu
       → align-items:center re-centre, identique au web, décalé sous l'île. */
    padding-top: var(--wsafe-top, env(safe-area-inset-top));
    min-height: calc(var(--wsafe-top, env(safe-area-inset-top)) + 56px);
}

body.woopets-shell .demo-sidebar {
    padding-top: var(--wsafe-top, env(safe-area-inset-top));
}

/* --- Bannière hors-ligne (shell mobile uniquement) -------------------------
   #wooOfflineBanner et la classe body.woopets-offline ne sont POSÉS QUE par le
   bridge natif (demo-native.js, initNetwork) → totalement inertes sur le web.
   Pinne en haut sous l'encoche, au-dessus de l'UI (sous le kill-switch 99999).
   Évite l'écran d'erreur navigateur que la review Apple 4.2 sanctionne. */
.woopets-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9500;
    padding: calc(var(--wsafe-top, env(safe-area-inset-top)) + 6px) 12px 8px;
    background: var(--c-text);
    color: var(--c-text-inverse);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Envoi désactivé hors-ligne (classe posée uniquement par le bridge). */
body.woopets-offline .send-btn {
    opacity: 0.45;
    pointer-events: none;
}

/* --- Perf shell : latence de tap -------------------------------------------
   Le viewport du shell est zoomable (pas de maximum-scale, accessibilité) →
   WKWebView retient chaque tap ~350 ms pour discriminer un double-tap zoom.
   touch-action:manipulation supprime CE délai sur les éléments interactifs
   sans désactiver ni le scroll ni le pinch-zoom. Inerte sur le web. */
body.woopets-shell button,
body.woopets-shell a,
body.woopets-shell input,
body.woopets-shell textarea,
body.woopets-shell select,
body.woopets-shell label,
body.woopets-shell [role="button"] {
    touch-action: manipulation;
}

/* --- Perf shell : compositing GPU (lag du premier tap sur le menu) ---------
   Le backdrop-filter force WebKit à créer une « backdrop root » au premier
   composite (re-rasterisation plein écran) : sur GPU iPhone, la PREMIÈRE
   ouverture du menu payait ce coût en plein boot déjà saturé. Le voile rgba
   sombre suffit visuellement dans l'app. Le blur de la topbar (permanent →
   re-blur à chaque frame de scroll) est remplacé par un fond opaque de la
   même teinte. Inerte sur le web (classe jamais posée). */
body.woopets-shell .sidebar-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Pré-rendu : display:block permanent (invisible via opacity:0), seule
       l'opacité anime → le premier tap sur le menu ne paie plus le
       style+layout+paint d'un fixed plein écran créé à la volée.
       pointer-events:none le rend inerte tant qu'il est invisible.
       Bonus : le fade-out joue aussi à la fermeture. */
    display: block;
    pointer-events: none;
}

body.woopets-shell .sidebar-overlay.active {
    pointer-events: auto;
}

body.woopets-shell .demo-topbar {
    /* rgba(250, 250, 247,.92) aplati : sans blur, un fond translucide laisserait
       transparaître le contenu scrollé sous la topbar. */
    background: #fafaf7;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

@media (max-width: 767px) {
    /* Sidebar off-canvas : layer GPU pré-promue → le premier open du menu n'a
       pas à rasteriser 260px × hauteur d'écran au moment du tap. */
    body.woopets-shell .demo-sidebar {
        will-change: transform;
    }
}

/* --- Safe-area shell : écrans plein écran et bords d'écran -----------------
   La WebView est bord-à-bord (ios.contentInset 'never') : tout conteneur
   fullscreen ou ancré à un bord DOIT dégager la Dynamic Island (haut, ~59px)
   et le home indicator (bas, ~34px). Pattern : var(--wsafe-*) natif en
   priorité, env() en fallback. Inerte sur le web (classe jamais posée). */

@media (max-width: 767px) {
    /* Famille .auth-modal — fullscreen mobile (login, register, forgot
       password, account, limit/quota) : padding statique 24px → contenu et
       croix sous l'île. La croix (position:absolute top:16px) a besoin de son
       propre offset : le padding du conteneur ne la déplace pas. */
    body.woopets-shell .auth-modal {
        padding-top: calc(var(--wsafe-top, env(safe-area-inset-top)) + 24px);
        padding-bottom: calc(var(--wsafe-bottom, env(safe-area-inset-bottom)) + 24px);
    }

    body.woopets-shell .auth-modal-close {
        top: calc(var(--wsafe-top, env(safe-area-inset-top)) + 16px);
    }
}

/* Bas d'écran : zone input (toujours visible) + footer compte de la sidebar. */
body.woopets-shell .demo-input-area {
    padding-bottom: max(0.85rem, var(--wsafe-bottom, env(safe-area-inset-bottom)));
}

body.woopets-shell .sidebar-bottom {
    padding-bottom: calc(var(--wsafe-bottom, env(safe-area-inset-bottom)) + 0.5rem);
}

/* Défensifs : overlays centrés qui peuvent atteindre les bords si le contenu
   grossit (rating 90vh) ou si le fallback web s'active (scanner html5-qrcode). */
body.woopets-shell .training-rating-overlay {
    padding: calc(var(--wsafe-top, env(safe-area-inset-top)) + 20px) 20px
             calc(var(--wsafe-bottom, env(safe-area-inset-bottom)) + 20px);
}

body.woopets-shell .scanner-header {
    padding-top: max(16px, var(--wsafe-top, env(safe-area-inset-top)));
}

body.woopets-shell .scanner-subtitle {
    padding-bottom: max(16px, var(--wsafe-bottom, env(safe-area-inset-bottom)));
}

/* ============================================================
   Confirmation brandée (W.confirmDialog) — remplace window.confirm().
   Dans demo-core.css (non lazy) car utilisée par sidebar/chat/pets/health/photos.
   z-index 9700 : au-dessus de la lightbox photos (3000), sous les toasts (9999).
   ============================================================ */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9700;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-backdrop-filter: blur(2px); /* WKWebView / Safari < 18 */
    backdrop-filter: blur(2px);
}

.confirm-modal-overlay.active { display: flex; }

.confirm-modal {
    background: var(--c-bg-card);
    border-radius: 16px;
    padding: 22px 22px 18px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    animation: confirmModalIn 220ms var(--ease-spring);
}

@keyframes confirmModalIn {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .confirm-modal { animation: none; }
}

.confirm-modal-msg {
    font-size: 0.92rem;
    color: var(--c-text);
    line-height: 1.5;
    margin: 0 0 16px;
    overflow-wrap: break-word;
}

.confirm-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.confirm-modal-actions button {
    padding: 9px 16px;
    min-height: 40px;
    border-radius: var(--r-sm);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.confirm-modal-cancel {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text-secondary);
}

.confirm-modal-cancel:hover {
    background: var(--c-bg-warm);
    color: var(--c-text);
}

.confirm-modal-ok {
    background: var(--c-primary);
    border: 1px solid var(--c-primary);
    color: var(--c-text-inverse);
}

.confirm-modal-ok:hover {
    background: var(--c-primary-hover);
    border-color: var(--c-primary-hover);
}

.confirm-modal-ok.danger {
    background: var(--c-danger);
    border-color: var(--c-danger);
}

.confirm-modal-ok.danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Woopets+ (abonnement woopets.fr, 05/11/2026) : badge du compte (menu, « Mon compte »). */
.user-plus-badge { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 4px; padding: 0 7px; border-radius: 9999px; background: var(--c-primary); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 16px; letter-spacing: .01em; }
.user-plus-badge b { color: #ffd8bf; font-weight: 800; }
.user-plus-badge--grand { margin: 0; padding: 3px 11px; font-size: 0.8rem; line-height: 20px; flex: 0 0 auto; }
.account-plus { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 16px; padding: 14px; border-radius: 14px; background: var(--c-primary-light); }
.account-plus strong { display: block; font-size: 0.92rem; color: var(--c-text); }
.account-plus p { margin: 3px 0 0; font-size: 0.82rem; line-height: 1.4; color: var(--c-text-muted); }

/* ==========================================================================
   [VILLAGE-RETURN] [VILLAGE-MENU] Allers-retours avec le Woopets Village (MONDE-12).
   Les deux éléments sont posés par demo-init.js, hors application et hors widget.
   ========================================================================== */

/* La barre de retour. Sur téléphone : une bande dans la colonne principale, sous la barre du
   haut. Sur écran large : une pastille dans la barre du haut, à droite (`.is-chip`, cf. plus bas)
   — c'est demo-init.js qui la pose à l'un ou l'autre endroit. Dans les deux cas elle prend sa
   place dans la mise en page (rien n'est recouvert) et reste là sur toutes les vues. */
.village-return {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 4px 0 8px;
    background: var(--c-primary-light);
    border-bottom: 1px solid var(--c-border);
}

.village-return-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    color: var(--c-primary);
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
}

.village-return-link:hover span { text-decoration: underline; text-underline-offset: 3px; }

.village-return-close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--r-full);
    background: none;
    color: var(--c-text-secondary);
    cursor: pointer;
}

.village-return-close:hover { background: rgba(24, 79, 82, 0.08); }

.village-return-link:focus-visible,
.village-return-close:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -2px; }

/* Écran large : une pastille dans la barre du haut. (Retour d'Anthony, 16 novembre 2026 : la bande
   sur toute la largeur de la colonne y coupait la page, le lien perdu en son milieu.) */
.village-return.is-chip {
    gap: 0;
    min-height: 36px;
    padding: 0 2px 0 4px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-full);
}

.village-return.is-chip .village-return-link {
    min-height: 34px;
    padding: 0 6px;
    border-radius: var(--r-full);
}

.village-return.is-chip .village-return-close { width: 30px; height: 30px; }

/* L'entrée de la barre latérale : même allure que « Explorer », juste au-dessus d'elle dans le
   code (demo-explore.css) — mais c'est un lien, et elle reste visible sur téléphone (le Village
   n'a pas d'onglet dans la barre du bas). */
.sidebar-village-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--c-text);
    font-size: 0.9rem;
    font-weight: 550;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease-out);
}

.sidebar-village-btn:hover { background: rgba(24, 79, 82, 0.06); }
.sidebar-village-btn svg { color: var(--c-primary); flex-shrink: 0; }
.sidebar-village-btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ============================================================
   BARRE DU HAUT DU SITE, COLONNE EN CARTE, EN-TÊTE TÉLÉPHONE (étape 5, lots B2d et B2e du plan
   woopets.com)

   Dessin de la maquette (docs/maquette-accueil-woopets/accueil.css + oria.css) porté sur les
   classes de l'app. La barre du haut (.site-masthead, chat_body.twig) n'existe ni dans un widget
   (gabarit) ni dans l'app (retirée par build-app-shell.php) : toute règle qui en dépend est donc
   scopée sur sa présence, et ne touche jamais l'app ni le widget.
   - Ordinateur (≥ 768 px, B2d) : barre du haut toujours là (logo, langue, compte ; les liens à
     partir de 1 024 px), page centrée sur 1 256 px, colonne de gauche en carte blanche, barre de
     titre légère, pied de page sur une ligne. Règles en body:has(> .site-masthead) — elles ne
     jouent qu'à cette largeur, où :has() ne coûte rien.
   - Téléphone (< 768 px, B2e) : la barre du haut (logo, langue, « S'inscrire » ou l'initiale)
     coiffe l'ACCUEIL d'Oria seulement (body.is-chat-welcome) ; en dessous, « Mes conversations »
     (le bouton d'historique, devenu pastille) et le titre. En conversation et dans les autres
     onglets, l'en-tête de toujours (une seule ligne, place gardée pour lire). Règles en
     .site-masthead ~ .demo-layout (frère, pas de :has() sur mobile : WebKit le re-évalue à
     chaque mutation du DOM). L'initiale ouvre l'onglet Profil, qui EST le compte au téléphone.
   ============================================================ */

.site-masthead { display: none; }
.topbar-menu-label { display: none; }

/* ---- Composants de la barre (cachée par défaut : ils ne servent qu'une fois montrée) ---- */
.site-masthead [hidden] { display: none !important; }

.site-masthead-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.site-masthead-brand {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    flex-shrink: 0;
}
.site-masthead-brand svg { display: block; width: 112px; height: auto; }

.site-masthead-nav { display: none; }

.site-masthead-utility {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Langue : <details> sans script (le menu se referme au clic ailleurs : initMasthead) */
.site-masthead-lang { position: relative; }
.site-masthead-lang > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.36rem;
    min-height: 44px;
    padding: 0 6px;
    border-radius: var(--r-full);
    list-style: none;
    cursor: pointer;
    user-select: none;
    font-size: 0.84rem;
    font-weight: 630;
    color: var(--c-text);
    -webkit-tap-highlight-color: transparent;
}
.site-masthead-lang > summary::-webkit-details-marker { display: none; }
.site-masthead-lang > summary svg:last-child { transition: transform var(--dur-fast); }
.site-masthead-lang[open] > summary svg:last-child { transform: rotate(180deg); }
.site-masthead-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 170px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}
.site-masthead-lang-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 0.9rem;
    color: var(--c-text);
    text-decoration: none;
}
.site-masthead-lang-menu a:focus-visible { outline: 2px solid var(--c-primary); outline-offset: -3px; }
.site-masthead-lang-menu a[aria-current] { color: var(--c-primary); font-weight: 650; }

/* Compte : « Se connecter » au trait, « S'inscrire » en teal (le corail reste au bouton d'envoi) */
.site-masthead-login,
.site-masthead-register,
.site-masthead-account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    border-radius: var(--r-full);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 630;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.site-masthead-login,
.site-masthead-account {
    padding: 0 18px;
    border: 1px solid rgba(24, 79, 82, 0.28);
    background: transparent;
    color: var(--c-text);
}
.site-masthead-register {
    padding: 0 18px;
    border: 1px solid var(--c-primary);
    background: var(--c-primary);
    color: var(--c-text-inverse);
}
.site-masthead-account { padding: 0 14px 0 5px; }
.site-masthead-initial {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
    background: var(--c-primary-light);
    color: var(--c-primary);
    font-size: 0.86rem;
    font-weight: 700;
}
.site-masthead-initial img { width: 100%; height: 100%; object-fit: cover; }
.site-masthead-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

.site-masthead a:focus-visible,
.site-masthead button:focus-visible,
.site-masthead summary:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 4px; }

@media (hover: hover) {
    .site-masthead-lang > summary:hover { color: var(--c-primary); }
    .site-masthead-lang-menu a:hover { background: var(--c-bg-warm); }
    .site-masthead-login:hover,
    .site-masthead-account:hover { background: var(--c-primary-light); }
    .site-masthead-register:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
}

/* ============================================================
   Ordinateur et tablette (≥ 768 px) — lot B2d
   ============================================================ */
@media (min-width: 768px) {
    body:not(.woopets-shell) > .site-masthead {
        display: block;
        flex-shrink: 0;
        position: relative;
        z-index: 60; /* le menu des langues passe au-dessus de la colonne et du chat */
        background: var(--c-bg);
    }

    body:has(> .site-masthead):not(.woopets-shell) {
        /* Mêmes mesures que l'en-tête des pages du site (site-shell.css : --shell, 72 px, et sa
           gouttière à partir de 1 024 px — plus bas) : passer d'une page d'information à l'app
           ne fait rien bouger. */
        --chat-gutter: clamp(16px, 3vw, 56px);
        --chat-shell: 1256px;
        --masthead-h: 72px;
    }

    .site-masthead-inner {
        width: min(calc(100% - 2 * var(--chat-gutter)), var(--chat-shell));
        margin-inline: auto;
        min-height: var(--masthead-h);
        gap: 28px;
    }
    .site-masthead-brand svg { width: 124px; }
    .site-masthead-utility { gap: clamp(8px, 1.2vw, 18px); }

    /* ---- La page : centrée, la colonne de gauche en carte ---- */
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout {
        width: min(calc(100% - 2 * var(--chat-gutter)), var(--chat-shell));
        margin-inline: auto;
        gap: clamp(16px, 2.2vw, 32px);
        padding-bottom: 14px;
    }

    body:has(> .site-masthead):not(.woopets-shell) .demo-sidebar {
        width: 248px;
        height: auto;
        align-self: stretch;
        padding: 12px;
        background: var(--c-bg-card);
        border: 1px solid var(--c-border);
        border-radius: 18px;
        overflow: hidden;
    }

    /* Le logo est dans la barre du haut : plus de marque dans la colonne */
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-header-top { display: none; }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-header {
        padding: 0 0 10px;
        border-bottom: 1px solid var(--c-border-light);
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-new-cta {
        margin-top: 0;
        min-height: 46px;
        border: none;
        border-radius: var(--r-full);
        font-size: 0.92rem;
        font-weight: 630;
    }

    body:has(> .site-masthead):not(.woopets-shell) .sidebar-pets-section {
        background: transparent;
        border-bottom-color: var(--c-border-light);
        padding: 6px 0 8px;
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-pets-title {
        font-family: var(--f-display);
        font-size: 1.06rem;
        font-weight: 600;
        letter-spacing: -0.03em;
        text-transform: none;
        color: var(--c-text);
        padding: 0.4rem 0.5rem;
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-pets-count { font-family: var(--f-body); font-size: 0.82rem; color: var(--c-text-muted); }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-pet-item { border-radius: var(--r-md); }

    body:has(> .site-masthead):not(.woopets-shell) .sidebar-conversations { padding: 4px 0; }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-group { padding: 0; }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-group-label {
        font-size: 0.76rem;
        letter-spacing: 0;
        text-transform: none;
        padding: 12px 8px 4px;
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-conv-item {
        min-height: 40px;
        padding: 0 4px 0 8px;
        border-left: none;
        border-radius: 10px;
        font-size: 0.89rem;
        color: var(--c-text-secondary);
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-conv-item:hover { background: var(--c-bg-warm); }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-conv-item.active {
        background: var(--c-primary-light);
        color: var(--c-primary);
        font-weight: 620;
    }

    body:has(> .site-masthead):not(.woopets-shell) .sidebar-explore-btn,
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-village-btn { border-radius: 10px; }

    /* Pied de colonne : le compte est dans la barre du haut, « Paramètres » reste ici */
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-user-section { display: none; }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-bottom {
        padding: 8px 0 0;
        border-top-color: var(--c-border-light);
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-settings-btn {
        min-height: 40px;
        border-radius: 10px;
        color: var(--c-text-muted);
    }
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-settings-btn:hover { background: var(--c-bg-warm); color: var(--c-text); }

    /* ---- Barre de titre de la conversation : légère, sans fond (la barre du haut porte la page) ---- */
    body:has(> .site-masthead):not(.woopets-shell) .demo-topbar {
        min-height: 44px;
        padding: 0 4px;
        background: transparent;
        border-bottom: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    body:has(> .site-masthead):not(.woopets-shell) .topbar-title {
        font-size: 0.86rem;
        color: var(--c-text-muted);
    }
    /* En conversation, son titre est dans la pastille de l'expert : pas de second titre */
    body:has(> .site-masthead):not(.woopets-shell).tab-chat:not(.is-chat-welcome):not(.is-subview) .topbar-title { display: none; }
    body:has(> .site-masthead):not(.woopets-shell) .topbar-new-btn {
        width: 40px;
        height: 40px;
        border-radius: var(--r-full);
    }
    /* « S'inscrire » est déjà dans la barre du haut */
    body:has(> .site-masthead):not(.woopets-shell) .topbar-register-btn { display: none; }

    /* Pied de page : celui du site, à la largeur de la page et sur le papier (maquette) */
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer {
        background: var(--c-bg);
        border-top-color: var(--c-border-light);
        padding-block: 0.55rem;
    }
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer .site-footer-inner {
        width: min(calc(100% - 2 * var(--chat-gutter)), var(--chat-shell));
        max-width: none;
    }
    /* La langue est dans la barre du haut : le pied de page du chat tient sur une ligne
       (chaque ligne prise ici l'est sur la conversation). Les liens restent dans le HTML. */
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer .site-footer-lang { display: none; }
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer .site-footer-links { gap: 0 1rem; font-size: 12.5px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablette : sans la mention de copyright, les liens tiennent sur une ligne */
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer .site-footer-meta { display: none; }
}

@media (min-width: 1024px) {
    .site-masthead-nav {
        display: flex;
        align-items: center;
        gap: clamp(18px, 2vw, 34px);
    }
    .site-masthead-utility { margin-left: 0; }
    .site-masthead-nav a,
    .site-masthead-nav button {
        position: relative;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0;
        border: none;
        background: none;
        font-family: inherit;
        font-size: 0.91rem;
        font-weight: 560;
        color: var(--c-text-muted);
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
    }
    .site-masthead-nav a::after,
    .site-masthead-nav button::after {
        content: '';
        position: absolute;
        inset: auto 0 4px;
        height: 2px;
        background: var(--c-primary);
        transform: scaleX(0);
        transition: transform 0.18s var(--ease-out);
    }
    .site-masthead-nav a:hover,
    .site-masthead-nav button:hover,
    .site-masthead-nav a[aria-current] { color: var(--c-primary); }
    .site-masthead-nav a[aria-current]::after { transform: scaleX(1); }

    body:has(> .site-masthead):not(.woopets-shell) .demo-sidebar { width: 276px; }

    /* Explorer, Village : dans la barre du haut à cette largeur */
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-explore-btn,
    body:has(> .site-masthead):not(.woopets-shell) .sidebar-village-btn { display: none; }
}

/* ============================================================
   Téléphone (< 768 px) — lot B2e : l'accueil d'Oria de la maquette, sur le site ET dans l'app
   (23/11/2026, demande d'Anthony : « reprendre la version mobile pour l'app »). Chaque règle
   .site-masthead ~ .demo-layout … a sa jumelle body.woopets-shell .demo-layout … (l'app n'a pas la
   barre du site ; jamais de :has() au téléphone) ; les marges d'encoche de l'app sont reprises
   à la fin du bloc.
   ============================================================ */
@media (max-width: 767px) {
    body.is-chat-welcome > .site-masthead {
        display: block;
        flex-shrink: 0;
        position: relative;
        z-index: 30; /* sous le voile (40) et le tiroir des conversations (50) */
        background: var(--c-bg);
    }
    .site-masthead-inner {
        min-height: 60px;
        padding: 0 16px;
    }
    /* Au téléphone, « S'inscrire » seul (décision d'Anthony, 23/11/2026 — la maquette montrait
       « Se connecter ») : les deux boutons ne tiennent pas à côté du logo et de la langue. La
       connexion reste à un lien, dans la fenêtre d'inscription et dans l'onglet Profil.
       Membre : l'initiale seule, ronde, sans cadre. */
    .site-masthead-login { display: none; }
    .site-masthead-register { min-height: 44px; padding: 0 16px; font-size: 0.86rem; }
    .site-masthead-account { width: 44px; padding: 0; border: none; }
    .site-masthead-account .site-masthead-initial { width: 44px; height: 44px; font-size: 1rem; }
    .site-masthead-name { display: none; }

    /* En conversation (une seule ligne) : boutons ronds au trait, comme les pastilles de la maquette */
    .site-masthead ~ .demo-layout .topbar-menu-btn,
    body.woopets-shell .demo-layout .topbar-menu-btn,
    .site-masthead ~ .demo-layout .topbar-new-btn,
    body.woopets-shell .demo-layout .topbar-new-btn {
        width: 44px;
        height: 44px;
        border: 1px solid rgba(24, 79, 82, 0.28);
        border-radius: var(--r-full);
        color: var(--c-primary);
    }

    /* Sous la barre : « Mes conversations » à gauche, le titre à droite (maquette) */
    body.is-chat-welcome .site-masthead ~ .demo-layout .demo-topbar,
    body.woopets-shell.is-chat-welcome .demo-layout .demo-topbar {
        min-height: 56px;
        padding: 4px 16px 6px;
        border-bottom: none;
        background: var(--c-bg);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-left,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-left { flex: 1; min-width: 0; justify-content: space-between; }
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-brand,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-brand,
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-register-btn,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-register-btn { display: none; }
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-title,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-title {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.86rem;
        font-weight: 600;
        color: var(--c-text-muted);
    }
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-menu-btn,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-menu-btn {
        flex-shrink: 0;
        width: auto;
        height: 44px;
        gap: 8px;
        padding: 0 14px 0 11px;
        border: 1px solid rgba(24, 79, 82, 0.28);
        border-radius: var(--r-full);
        color: var(--c-primary);
        font-family: inherit;
        font-size: 0.86rem;
        font-weight: 620;
    }
    body.is-chat-welcome .site-masthead ~ .demo-layout .topbar-menu-label,
    body.woopets-shell.is-chat-welcome .demo-layout .topbar-menu-label { display: inline; }

    /* Le tiroir « Mes conversations » (maquette) : carte blanche arrondie à droite, la pastille
       « Nouvelle conversation » avec la croix à côté, l'historique au dessin de l'ordinateur. */
    .site-masthead ~ .demo-layout .demo-sidebar,
    body.woopets-shell .demo-layout .demo-sidebar {
        width: min(86vw, 330px);
        padding: 12px;
        background: var(--c-bg-card);
        border-right: none;
        border-radius: 0 20px 20px 0;
    }
    .site-masthead ~ .demo-layout .demo-sidebar.open,
    body.woopets-shell .demo-layout .demo-sidebar.open { box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2); }
    .site-masthead ~ .demo-layout .sidebar-header,
    body.woopets-shell .demo-layout .sidebar-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0 0 10px;
        border-bottom: 1px solid var(--c-border-light);
    }
    .site-masthead ~ .demo-layout .sidebar-header-top,
    body.woopets-shell .demo-layout .sidebar-header-top { order: 2; min-height: 0; }
    .site-masthead ~ .demo-layout .sidebar-brand,
    body.woopets-shell .demo-layout .sidebar-brand { display: none; }
    .site-masthead ~ .demo-layout .sidebar-close-btn,
    body.woopets-shell .demo-layout .sidebar-close-btn { width: 44px; height: 44px; border-radius: 50%; color: var(--c-primary); }
    .site-masthead ~ .demo-layout .sidebar-new-cta,
    body.woopets-shell .demo-layout .sidebar-new-cta {
        order: 1;
        flex: 1;
        width: auto;
        margin-top: 0;
        min-height: 46px;
        border: none;
        border-radius: var(--r-full);
        font-size: 0.92rem;
        font-weight: 630;
    }
    .site-masthead ~ .demo-layout .sidebar-pets-section,
    body.woopets-shell .demo-layout .sidebar-pets-section {
        background: transparent;
        border-bottom-color: var(--c-border-light);
        padding: 6px 0 8px;
    }
    .site-masthead ~ .demo-layout .sidebar-pets-title,
    body.woopets-shell .demo-layout .sidebar-pets-title {
        font-family: var(--f-display);
        font-size: 1.06rem;
        font-weight: 600;
        letter-spacing: -0.03em;
        text-transform: none;
        color: var(--c-text);
        padding: 0.4rem 0.5rem;
    }
    .site-masthead ~ .demo-layout .sidebar-group,
    body.woopets-shell .demo-layout .sidebar-group { padding: 0; }
    .site-masthead ~ .demo-layout .sidebar-group-label,
    body.woopets-shell .demo-layout .sidebar-group-label {
        font-size: 0.76rem;
        letter-spacing: 0;
        text-transform: none;
        padding: 12px 8px 4px;
    }
    .site-masthead ~ .demo-layout .sidebar-conv-item,
    body.woopets-shell .demo-layout .sidebar-conv-item {
        min-height: 44px;
        padding: 0 4px 0 8px;
        border-left: none;
        border-radius: 10px;
        font-size: 0.89rem;
        color: var(--c-text-secondary);
    }
    .site-masthead ~ .demo-layout .sidebar-conv-item.active,
    body.woopets-shell .demo-layout .sidebar-conv-item.active {
        background: var(--c-primary-light);
        color: var(--c-primary);
        font-weight: 620;
    }
    .site-masthead ~ .demo-layout .sidebar-village-btn,
    body.woopets-shell .demo-layout .sidebar-village-btn { border-radius: 10px; min-height: 44px; }
    .site-masthead ~ .demo-layout .sidebar-bottom,
    body.woopets-shell .demo-layout .sidebar-bottom { padding: 8px 0 0; border-top-color: var(--c-border-light); }
    .site-masthead ~ .demo-layout .sidebar-more,
    body.woopets-shell .demo-layout .sidebar-more { border-top: none; margin-top: 0; }

    /* L'app : mêmes dessins, plus l'encoche et la barre d'accueil d'iOS. Sur le site, la barre du
       haut porte l'encoche ; dans l'app, ce sont la barre de titre et le tiroir eux-mêmes
       (body.woopets-shell .demo-topbar / .demo-sidebar, plus haut — les règles ci-dessus, plus
       précises, les écrasaient). */
    body.woopets-shell.is-chat-welcome .demo-layout .demo-topbar {
        padding-top: calc(var(--wsafe-top, env(safe-area-inset-top)) + 4px);
        min-height: calc(var(--wsafe-top, env(safe-area-inset-top)) + 56px);
    }
    body.woopets-shell .demo-layout .demo-sidebar { padding-top: calc(var(--wsafe-top, env(safe-area-inset-top)) + 12px); }
    body.woopets-shell .demo-layout .sidebar-bottom { padding-bottom: var(--wsafe-bottom, env(safe-area-inset-bottom)); }
}

/* Très petit téléphone (< 360 px) : logo et boutons resserrés, rien ne déborde (« Registrieren ») */
@media (max-width: 359px) {
    .site-masthead-inner { gap: 8px; padding: 0 12px; }
    .site-masthead-brand svg { width: 96px; }
    .site-masthead-utility { gap: 2px; }
    .site-masthead-lang > summary { padding: 0 4px; }
    .site-masthead-register { padding: 0 12px; font-size: 0.8rem; }
    body.is-chat-welcome .site-masthead ~ .demo-layout .demo-topbar,
    body.woopets-shell.is-chat-welcome .demo-layout .demo-topbar { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .site-masthead-nav a::after,
    .site-masthead-nav button::after,
    .site-masthead-lang > summary svg:last-child { transition: none; }
}

/* ============================================================
   MISE EN PAGE ORDINATEUR PAR VUE (refonte du 23/11/2026)
   Conception : docs/ux/redesign-desktop-2026-11-23.md

   <body data-view="…"> (W.syncViewAttr, demo-core.js ; première estimation par le script en ligne
   de chat_body.twig) dit quelle vue est affichée. Deux gabarits :
   - « atelier » (data-view="chat") : Oria garde la colonne de l'historique, la conversation
     prend toute la hauteur (plus de pied de page fixe, barre de titre fondue) ;
   - « page » (toutes les autres vues, ≥ 1 024 px) : pas de colonne, contenu centré sous le menu
     du haut à la largeur de sa famille (--page-w), pied de page en fin de page.
   Tablette (768-1 023 px) : la colonne reste sur toutes les vues — c'est elle qui porte la
   navigation, le menu du haut n'y affiche pas ses liens.
   Tout est scopé sur la barre du haut : rien ne joue dans l'app, le widget, ni au téléphone.
   Ces règles vivent ICI (feuille critique) : posées dans une feuille différée, elles feraient
   bouger la page à l'arrivée de cette feuille.
   ============================================================ */

@media (min-width: 768px) {
    /* ---- Barre de titre : plus de « + » (la colonne porte « Nouvelle conversation ») ---- */
    body:has(> .site-masthead):not(.woopets-shell) .topbar-new-btn { display: none; }
    /* Accueil d'Oria : la barre ne portait qu'un libellé — elle rend sa hauteur à la page */
    body:has(> .site-masthead):not(.woopets-shell).is-chat-welcome[data-view="chat"] .demo-topbar { display: none; }

    /* ---- En conversation : la pastille de l'expert flotte, la lecture passe dessous ---- */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .demo-main { position: relative; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"]:not(.is-chat-welcome) .demo-topbar {
        position: absolute;
        inset: 0 0 auto;
        z-index: 5;
        min-height: 56px;
        padding: 0 8px;
        pointer-events: none;
        background: linear-gradient(to bottom, var(--c-bg) 46%, transparent);
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"]:not(.is-chat-welcome) .demo-topbar > * { pointer-events: auto; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"]:not(.is-chat-welcome) .chat-messages-scroll { padding-top: 64px; }

    /* ---- Menu de compte : un menu déroulant sous la pastille, pas une fenêtre au milieu ---- */
    body:has(> .site-masthead):not(.woopets-shell) .account-menu-overlay {
        align-items: flex-start;
        justify-content: flex-end;
        padding: calc(var(--masthead-h) - 8px) max(var(--chat-gutter), calc((100% - var(--chat-shell)) / 2)) 0;
        background: transparent;
    }
    body:has(> .site-masthead):not(.woopets-shell) .account-menu {
        width: 264px;
        max-width: 264px;
        padding: 6px;
        border: 1px solid var(--c-border);
        border-radius: 14px;
        box-shadow: var(--shadow-lg);
        animation: mastheadMenuIn var(--dur-fast) var(--ease-out);
    }
    /* La pastille juste au-dessus dit déjà qui est connecté (photo et prénom) */
    body:has(> .site-masthead):not(.woopets-shell) .account-menu-header { display: none; }
    body:has(> .site-masthead):not(.woopets-shell) .account-menu-item { min-height: 44px; border-radius: 9px; }
}

@keyframes mastheadMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 1024px) {
    body:has(> .site-masthead):not(.woopets-shell) {
        --chat-gutter: clamp(20px, 4.4vw, 72px); /* = --gutter de site-shell.css */
        --page-w: 720px;
        /* Marge intérieure qui centre une colonne de --page-w dans une zone pleine largeur */
        --page-pad: max(var(--chat-gutter), calc((100% - var(--page-w)) / 2));
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"],
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"],
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] { --page-w: 1040px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"],
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] { --page-w: 880px; }
    /* Vues qui gèrent elles-mêmes leur largeur : leur fil « ‹ titre » s'aligne sur le logo */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="adoption"],
    body:has(> .site-masthead):not(.woopets-shell)[data-view="education"],
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pro"] { --page-w: var(--chat-shell); }

    /* ============ Gabarit « atelier » : Oria ============ */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .demo-layout { padding-bottom: 12px; }
    /* La colonne ne garde que les conversations : animaux et réglages sont dans la barre du haut */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .sidebar-pets-section,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .sidebar-settings-btn { display: none !important; }
    /* Le pied de page ne prend plus de hauteur sur la conversation : ses liens sont dans « Plus » */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .demo-layout ~ .site-footer { display: none; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .sidebar-more { display: block; border-top: none; margin-top: 0; }

    /* Zone de saisie sur deux rangs : le texte, puis « photo · Outils · animaux … envoyer » */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .input-wrapper .services-toolbar-row { flex: 0 0 auto; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .input-wrapper .pet-chips-row {
        order: 4;
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 0 0 0 4px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .input-wrapper .send-btn { margin-left: auto; }

    /* ============ Gabarit « page » : toutes les autres vues ============ */
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .demo-sidebar,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .sidebar-overlay { display: none; }
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .demo-layout {
        width: 100%;
        gap: 0;
        padding-bottom: 0;
    }
    /* Adresse d'une vue autre qu'Oria : rien d'Oria ne s'affiche en attendant que la vue s'ouvre */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="boot"] .demo-main { visibility: hidden; }

    /* Barre de titre des sous-vues (fiche, carnet, formulaire…) : un fil « ‹ titre » aligné sur la page */
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .demo-topbar {
        min-height: 48px;
        padding: 4px var(--page-pad) 0;
    }
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .topbar-left { margin-left: -10px; }
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .topbar-title { font-size: 0.9rem; font-weight: 600; }
    /* Vues racines du menu du haut : ni retour ni titre répété */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .demo-topbar,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .demo-topbar,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .demo-topbar { display: none; }

    /* Conteneurs : la zone défile sur toute la largeur (un seul ascenseur, au bord de la fenêtre),
       le contenu est centré à --page-w. 72 px en bas : la place du pied de page quand il paraît. */
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-explore-scroll,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-profil-scroll {
        max-width: none;
        padding: 20px var(--page-pad) 72px;
    }
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-pet-form-scroll,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-health-scroll {
        max-width: calc(var(--page-w) + 2 * var(--chat-gutter));
        padding: 20px var(--chat-gutter) 72px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .view-pet-form-scroll,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-form"] .view-pet-form-scroll,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .view-health-scroll { padding-top: 8px; }

    /* ---------- Carnet de Vie en deux colonnes (demo-health.js, carnetWide) ----------
       La frise à gauche (Journal · Poids), une colonne « À faire » à droite qui reste à l'écran
       quand on fait défiler la frise : cartes à traiter, « À vérifier », prévention, bilan du
       mois, check-in. Le formulaire d'un événement garde la largeur d'une page de lecture. */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"]:has(.carnet-cols) { --page-w: 1040px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-cols {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 336px;
        gap: 28px;
        align-items: start;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-main { min-width: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-main .health-tabs { max-width: 320px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside {
        position: sticky;
        top: 12px;
        display: flex;
        flex-direction: column;
        gap: 14px;
        min-width: 0;
        max-height: calc(100dvh - var(--masthead-h) - 84px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        /* De quoi laisser respirer l'ombre des cartes sans qu'elle soit rognée */
        margin: 0 -6px;
        padding: 2px 6px 12px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-aside-title {
        margin: 2px 0 0;
        font-family: var(--f-display);
        font-size: 1.15rem;
        font-weight: 600;
        letter-spacing: -0.02em;
        color: var(--c-text);
    }
    /* Cartes à traiter : les unes sous les autres (elles défilaient de côté) */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside .carnet-highlights { flex-direction: column; gap: 8px; overflow: visible; margin: 0; padding: 0; }
    /* … et chacune sur une ligne : le texte, l'action à droite (elles prenaient 130 px de haut) */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside .carnet-hl-card {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        min-width: 0;
        max-width: none;
        padding: 10px 10px 10px 14px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside .carnet-hl-text { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside .carnet-hl-actions { flex: 0 0 auto; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside .carnet-hl-btn { min-height: 36px; padding: 7px 13px; white-space: nowrap; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside > .carnet-verify,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside > .carnet-rhythms,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-col-aside > .carnet-chal-slot { margin-top: 0; margin-bottom: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-aside-panel:not([hidden]) { display: flex; flex-direction: column; gap: 14px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="health-records"] .carnet-aside-panel > * { margin-top: 0; margin-bottom: 0; }
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-education-scroll,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-adoption-scroll,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-pro-scroll,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .view-app-news-scroll { padding-bottom: 72px; }

    /* Pied de page : en fin de page seulement (body.page-end, initPageFooter — demo-init.js) */
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .demo-layout ~ .site-footer {
        position: fixed;
        inset: auto 0 0;
        z-index: 20;
        visibility: hidden;
        opacity: 0;
        transform: translateY(100%);
        transition: transform var(--dur-normal) var(--ease-out), opacity var(--dur-normal) var(--ease-out), visibility 0s linear var(--dur-normal);
    }
    body:has(> .site-masthead):not(.woopets-shell).page-end:not([data-view="chat"]) .demo-layout ~ .site-footer,
    body:has(> .site-masthead):not(.woopets-shell):not([data-view="chat"]) .demo-layout ~ .site-footer:focus-within {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }

    /* ---------- Accueil (Explorer) : une grille de 6 colonnes ---------- */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        align-content: start;
        gap: 16px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll > * { grid-column: 1 / -1; min-width: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-home-h {
        margin: 4px 0 0;
        font-family: var(--f-display);
        font-size: 1.75rem;
        font-weight: 600;
        letter-spacing: -0.03em;
    }
    /* Tuiles : 3 colonnes × 2 rangs, pictogramme à gauche, libellé et une ligne d'explication */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-themes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        min-height: 76px;
        padding: 12px 16px;
        text-align: left;
        border: 1px solid var(--c-border-light);
        box-shadow: none;
        transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme:hover { border-color: var(--c-primary); box-shadow: var(--shadow-sm); }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme-ic { width: 48px; height: 48px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme-ic svg { width: 22px; height: 22px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme-t { font-size: 0.98rem; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-theme-s {
        display: block;
        margin: 0;
        font-size: 0.82rem;
        line-height: 1.35;
        color: var(--c-text-muted);
    }
    /* Trois cartes côte à côte sous les tuiles (deux sans le Village) ; la suite dessous */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-village,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-day,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-carnet,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-clic:not([hidden]) { grid-column: span 2; order: 1; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll:not(:has(> .explore-village)) > .explore-day,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll:not(:has(> .explore-village)) > .explore-carnet { grid-column: span 3; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-village,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-day,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-carnet { box-shadow: none; border: 1px solid var(--c-border-light); }
    /* Membre avec des animaux : « Vos animaux » remplace la carte du Carnet — il reste deux
       cartes (Village, conseil du jour) côte à côte, ou le conseil seul sur toute la largeur */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll:not(:has(> .explore-carnet)) > .explore-village,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll:not(:has(> .explore-carnet)) > .explore-day { grid-column: span 3; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .view-explore-scroll:not(:has(> .explore-carnet)):not(:has(> .explore-village)) > .explore-day { grid-column: 1 / -1; }
    /* « Vos animaux » : quatre cartes sur un rang, au-dessus des tuiles */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-mine { margin-bottom: 8px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-mine-h { font-size: 1.35rem; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-mine-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-mine-card { transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-mine-card:hover { border-color: var(--c-primary); box-shadow: var(--shadow-sm); }

    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-village-cta { margin-top: auto; }
    /* Même tête de carte, action en pied : les trois cartes se lisent d'une traite */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-carnet {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 18px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-carnet > .explore-link,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-carnet > .explore-create-cta { margin-top: auto; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-day { padding: 18px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-day-txt { display: flex; flex-direction: column; align-items: flex-start; align-self: stretch; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-day-cta { margin-top: auto; min-height: 44px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-village { padding: 18px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-highlights { order: 2; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-news { order: 3; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-tip { order: 4; }
    /* « À la une » : une grille, plus de rail à faire défiler à la souris */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-news-rail {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
        overflow: visible;
        margin: 0;
        padding: 0;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-news-item:nth-child(n + 5) { display: none; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-news-thumb { height: 132px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="explore"] .explore-news-t { padding: 12px 14px 14px; font-size: 0.88rem; }

    /* ---------- Mes animaux : une grille de cartes ---------- */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-header { margin-bottom: 24px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-title {
        font-family: var(--f-display);
        font-size: 1.75rem;
        font-style: normal;
        font-weight: 600;
        letter-spacing: -0.03em;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-add-btn {
        min-height: 44px;
        padding-inline: 18px;
        border-color: var(--c-primary);
        border-radius: var(--r-full);
        background: var(--c-primary);
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-add-btn:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 14px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-section,
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-group { display: contents; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-section-label { display: none; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-list"] .pet-list-card { min-height: 96px; padding: 16px 18px; border-radius: var(--r-lg); }

    /* ---------- Fiche d'un animal : identité à gauche, dossier à droite ---------- */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-profile-card {
        display: grid;
        grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        gap: 14px 24px;
        align-items: start;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-profile-card > * { grid-column: 1; min-width: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-profile-card > .pet-profile-body { grid-column: 2; grid-row: 1 / -1; }
    /* Supprimer : hors du rang « Modifier · Poids », en lien discret dessous */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-quick-actions { flex-wrap: wrap; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-quick-action.pet-quick-danger {
        flex: 1 0 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 8px;
        min-height: 44px;
        padding: 0 6px;
        border: none;
        background: none;
        box-shadow: none;
        font-size: 0.84rem;
        opacity: 0.85;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="pet-profile"] .pet-quick-action.pet-quick-danger:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

    /* ---------- Profil : le compte à gauche, les réglages à droite ---------- */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .view-profil-scroll {
        display: grid;
        grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
        grid-template-rows: auto auto 1fr;
        align-content: start;
        align-items: start;
        gap: 14px 24px;
    }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .settings-lang-grid:not(.settings-units-grid) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    /* Cinq langues sur un rang : le libellé le plus long (« Français ») garde de l'air */
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .settings-lang-grid:not(.settings-units-grid) .settings-lang-btn { padding-inline: 6px; justify-content: center; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .view-profil-scroll > * { grid-column: 1; min-width: 0; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="profil"] .view-profil-scroll > .profil-settings-slot { grid-column: 2; grid-row: 1 / -1; }
}

/* Portable (hauteur ≤ 860 px) : l'accueil d'Oria se resserre pour que « Pour commencer » soit
   visible sans défiler. Une requête de média, pas une classe : rien ne bouge après le rendu. */
@media (min-width: 1024px) and (max-height: 860px) {
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .welcome-title { font-size: clamp(2.1rem, 3.1vw, 2.6rem); }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .welcome-subtitle { margin-top: 10px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .welcome-trust { margin-top: 14px; }
    body:has(> .site-masthead):not(.woopets-shell)[data-view="chat"] .welcome-experts { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    body:has(> .site-masthead):not(.woopets-shell) .account-menu { animation: none; }
    body:has(> .site-masthead):not(.woopets-shell) .demo-layout ~ .site-footer { transition: none; }
    body:has(> .site-masthead):not(.woopets-shell) .explore-theme { transition: none; }
}
