/* static/css/guide.css — Le guide : la colonne de gauche, sur tous les écrans
 *
 * Le guide est la colonne qu'on LIT ; l'outil, à droite, est ce qu'on regarde.
 * Il ne bouge jamais d'un écran à l'autre : même place, même largeur, même voix.
 * Réductible en un bandeau (la place compte sur un portable), jamais retiré.
 */
/* Un peu plus étroit depuis le 16/10/2026 (Alex) : au tiers exact, l'outil de
   droite manquait de place sur un portable. 28 % et 460 px au plus : 460 à
   1920 au lieu de 520, 382 à 1366 au lieu de 455. */
:root { --gd-l: clamp(18.75rem, 28vw, 28.75rem); --gd-reduit: 4rem; }

body.avec-guide .app-content { margin-left: var(--gd-l); transition: margin-left .35s var(--mr-ease, cubic-bezier(.32,.72,0,1)); }
body.avec-guide.guide-reduit .app-content { margin-left: var(--gd-reduit); }

.gd {
    position: fixed; left: 0; top: var(--topbar-actuelle, 4rem); bottom: 0; z-index: 90;
    width: var(--gd-l); display: flex; flex-direction: column;
    background: var(--mr-surface-sunken); border-right: 1px solid var(--mr-border);
    color: var(--mr-text); font-family: var(--mr-sans);
    transition: width .35s var(--mr-ease, cubic-bezier(.32,.72,0,1)), top .2s ease;
}
.gd *, .gd *::before, .gd *::after { box-sizing: border-box; }

/* L'en-tête : qui parle, pour quel projet. */
.gd-tete { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1rem 0.875rem 1.125rem; border-bottom: 1px solid var(--mr-border); flex: none; }
.gd-avatar { width: 2.375rem; height: 2.375rem; border-radius: 0.75rem; background: var(--mr-ink); display: grid; place-items: center; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.gd-avatar i { width: 1.5rem; height: 1.5rem; background-color: var(--mr-cream);
    -webkit-mask: url('/static/img/logo-mr.svg') center / contain no-repeat; mask: url('/static/img/logo-mr.svg') center / contain no-repeat; }
.gd-qui { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.gd-qui strong { font-family: var(--mr-serif); font-size: 1.15rem; font-weight: 600; color: var(--mr-text-strong); }
.gd-projet { font-size: .8rem; color: var(--mr-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-icone { width: 2rem; height: 2rem; border-radius: 0.625rem; border: 1px solid transparent; background: none; color: var(--mr-text-muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.gd-icone:hover { background: var(--mr-surface-hover); color: var(--mr-text-strong); border-color: var(--mr-border); }
.gd-icone svg, .gd-envoyer svg { width: 1.0625rem; height: 1.0625rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Le parcours en un regard : où j'en suis, sans ouvrir « Mon affaire ». */
.gd-parcours { list-style: none; margin: 0; padding: 0.75rem 1.125rem; display: flex; gap: 0.375rem; border-bottom: 1px solid var(--mr-border); flex: none; overflow-x: auto; scrollbar-width: none; }
.gd-parcours li { flex: 1 1 0; min-width: 2.875rem; display: grid; gap: 0.375rem; font-size: .7rem; color: var(--mr-text-muted); }
.gd-parcours li i { display: block; height: 0.25rem; border-radius: 0.125rem; background: var(--mr-border-strong); }
.gd-parcours li[data-etat="fait"] i { background: var(--mr-accent-up); }
.gd-parcours li[data-etat="suivante"] { color: var(--mr-text-strong); font-weight: 600; }
.gd-parcours li[data-etat="suivante"] i { background: var(--mr-orange); animation: gd-pouls 2.2s ease-in-out infinite; }
.gd-parcours a { color: inherit; text-decoration: none; display: grid; gap: 0.375rem; }
@keyframes gd-pouls { 50% { opacity: .45; } }

/* Le fil. */
.gd-fil { flex: 1; min-height: 0; overflow-y: auto; padding: 1.125rem 1.125rem 0.5rem; display: flex; flex-direction: column; gap: 0.875rem; scroll-behavior: smooth; }
.gd-msg { max-width: 100%; font-size: .94rem; line-height: 1.62; overflow-wrap: anywhere; animation: gd-entree .45s var(--mr-ease, cubic-bezier(.32,.72,0,1)) both; }
.gd-msg--lui { color: var(--mr-text); }
.gd-msg--lui p { margin: 0 0 .6em; } .gd-msg--lui p:last-child { margin-bottom: 0; }
.gd-msg--lui ul, .gd-msg--lui ol { margin: .3em 0 .6em; padding-left: 1.2em; }
.gd-msg--moi { align-self: flex-end; max-width: 86%; padding: 0.625rem 0.875rem; border-radius: 1rem 1rem 0.25rem 1rem; background: var(--mr-btn-bg); color: var(--mr-btn-text); font-size: .9rem; white-space: pre-wrap; }
.gd-msg--accueil { padding: 0.875rem 1rem; border-radius: 0.25rem 1rem 1rem 1rem; background: var(--mr-surface-card); border: 1px solid var(--mr-border); }
.gd-msg--panne { align-self: center; font-size: .82rem; color: var(--mr-rouge); text-align: center; }
.gd-separateur { align-self: center; font-size: .72rem; color: var(--mr-text-muted); letter-spacing: .04em; text-transform: uppercase; padding: 0.25rem 0; }
.gd-outil { font-size: .8rem; color: var(--mr-text-muted); display: flex; align-items: center; gap: 0.5rem; }
.gd-outil::before { content: ''; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--mr-orange); animation: gd-pouls 1.2s ease-in-out infinite; }
.gd-attente { display: inline-flex; gap: 0.25rem; padding: 0.375rem 0; }
.gd-attente span { width: 0.375rem; height: 0.375rem; border-radius: 50%; background: var(--mr-text-muted); animation: gd-saut 1s infinite ease-in-out; }
.gd-attente span:nth-child(2) { animation-delay: .15s; } .gd-attente span:nth-child(3) { animation-delay: .3s; }
@keyframes gd-saut { 40% { transform: translateY(-0.25rem); opacity: .5; } }
@keyframes gd-entree { from { opacity: 0; transform: translateY(0.5rem); } }

/* Les boutons que le guide propose : le geste, à portée de main. */
.gd-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.625rem; }
.gd-action { display: inline-flex; align-items: center; gap: 0.625rem; padding: 0.5625rem 0.5625rem 0.5625rem 0.9375rem; border-radius: 999px; background: var(--mr-btn-bg); color: var(--mr-btn-text); font: 600 .86rem var(--mr-sans); text-decoration: none; border: 0; cursor: pointer; transition: transform .2s var(--mr-ease, ease); }
.gd-action b { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 400; transition: transform .25s var(--mr-ease, ease); }
.gd-action:hover b { transform: translateX(0.125rem); }
.gd-action:active { transform: scale(.98); }
/* Une proposition de réglages : ce qui changera, puis le bouton qui l'applique. */
.gd-reglage { flex-basis: 100%; display: grid; gap: 0.5rem; padding: 0.75rem 0.875rem; border-radius: 0.875rem; border: 1px solid var(--mr-border-strong); background: var(--mr-surface-card); }
.gd-reglage p { margin: 0; font-size: .8rem; color: var(--mr-text-muted); }
.gd-reglage ul { margin: 0; padding-left: 1rem; display: grid; gap: 0.375rem; font-size: .84rem; line-height: 1.4; }
.gd-reglage .gd-action { justify-self: start; }
.gd-reglage .gd-action:disabled { opacity: .6; cursor: default; }
.gd-reglage small { font-size: .8rem; color: var(--mr-text-muted); }
.gd-reglage small:empty { display: none; }

/* Les suggestions : ce qu'on peut demander sans savoir quoi demander. */
.gd-suggestions { display: flex; flex-wrap: wrap; gap: 0.375rem; padding: 0.25rem 1.125rem 0.625rem; flex: none; }
.gd-suggestions:empty { display: none; }
.gd-sugg { padding: 0.4375rem 0.75rem; border-radius: 999px; border: 1px solid var(--mr-border-strong); background: var(--mr-surface); color: var(--mr-text); font: .82rem var(--mr-sans); cursor: pointer; text-decoration: none; }
.gd-sugg:hover { border-color: var(--mr-text-muted); color: var(--mr-text-strong); }
.gd-sugg--lien { border-style: dashed; }

/* La saisie. */
.gd-saisie { display: flex; align-items: flex-end; gap: 0.5rem; margin: 0 0.875rem 0.875rem; padding: 0.5rem 0.5rem 0.5rem 0.875rem; border: 1px solid var(--mr-border-strong); border-radius: 1.125rem; background: var(--mr-surface); flex: none; }
.gd-saisie:focus-within { border-color: var(--mr-text-muted); }
.gd-saisie textarea { flex: 1; border: 0; background: none; resize: none; color: var(--mr-text); font: .93rem/1.5 var(--mr-sans); max-height: 10rem; padding: 0.375rem 0; outline: none; }
.gd-envoyer { width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; border: 0; background: var(--mr-btn-bg); color: var(--mr-btn-text); display: grid; place-items: center; cursor: pointer; flex: none; }
.gd-envoyer[disabled] { opacity: .4; cursor: default; }

/* Réduit : un bandeau avec l'avatar, la conversation reste là. */
body.guide-reduit .gd { width: var(--gd-reduit); }
body.guide-reduit .gd > :not(.gd-tete) { display: none; }
body.guide-reduit .gd-tete { flex-direction: column; padding: 0.875rem 0; border: 0; }
body.guide-reduit .gd-qui, body.guide-reduit #gdEffacer { display: none; }
body.guide-reduit .gd-reduire svg { transform: rotate(180deg); }

/* « Montrer » : l'élément visé brille, une bulle dit pourquoi. */
.gd-halo { position: relative; z-index: 80; outline: 0.1875rem solid var(--mr-orange) !important; outline-offset: 0.25rem; border-radius: 0.375rem; animation: gd-halo 1.6s ease-in-out 3; }
@keyframes gd-halo { 50% { outline-offset: 0.5625rem; outline-color: transparent; } }
.gd-bulle { position: absolute; z-index: 95; max-width: 18.75rem; padding: 0.75rem 0.875rem; border-radius: 0.875rem; background: var(--mr-ink); color: var(--mr-cream); font: .86rem/1.5 var(--mr-sans); box-shadow: 0 1.125rem 2.5rem rgba(0,0,0,.28); animation: gd-entree .35s var(--mr-ease, ease) both; }
.gd-bulle button { margin-left: 0.5rem; border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font: inherit; text-decoration: underline; }

/* Flair en conversation : le rail de Flair EST le guide (même place, même largeur). */
body.avec-guide:has(.ch.est-actif) .gd, body.avec-guide:has(.ch.est-actif) .gd-rouvrir { display: none; }
body.avec-guide:has(.ch.est-actif) .app-content { margin-left: 0; }
body.avec-guide .ch { --ch-rail: var(--gd-l); }

/* Sonar : le guide remplace le conseiller de la veille. */
body.avec-guide .sn-poste { grid-template-columns: minmax(0, 1fr); }
body.avec-guide .sn-conversation, body.avec-guide .sn-mobile-vues { display: none; }

/* Trace : le guide remplace aussi son assistant (Alex, 16/10/2026 : deux chats
   côte à côte, c'est un de trop). Ses gestes propres, résumer une page ou la
   découper en tâches, restent à faire passer par le guide. */
body.avec-guide .tr-ia { display: none; }
body.avec-guide .tr { grid-template-columns: minmax(0, 1fr); }

/* Le bouton de réouverture n'existe que sur téléphone. */
.gd-rouvrir { display: none; }

@media (max-width: 900px) {
    body.avec-guide .app-content, body.avec-guide.guide-reduit .app-content { margin-left: 0; }
    .gd { width: 100%; top: auto; height: min(78vh, 40rem); border-right: 0; border-top: 1px solid var(--mr-border); border-radius: 1.375rem 1.375rem 0 0;
          box-shadow: 0 -1.25rem 3.125rem rgba(0,0,0,.25); transform: translateY(105%); transition: transform .4s var(--mr-ease, cubic-bezier(.32,.72,0,1)); }
    body.guide-mobile-ouvert .gd { transform: none; }
    body.guide-reduit .gd { width: 100%; }
    body.guide-reduit .gd > :not(.gd-tete) { display: flex; }
    body.guide-reduit .gd-qui, body.guide-reduit #gdEffacer { display: grid; }
    body.guide-reduit .gd-tete { flex-direction: row; padding: 1rem; border-bottom: 1px solid var(--mr-border); }
    .gd-reduire svg { transform: rotate(-90deg); }
    body.avec-guide .gd-rouvrir { display: inline-flex; align-items: center; gap: 0.625rem; position: fixed; left: 1rem; bottom: 1rem; z-index: 89;
        padding: 0.375rem 1rem 0.375rem 0.375rem; border-radius: 999px; border: 1px solid var(--mr-border); background: var(--mr-surface-card); color: var(--mr-text-strong);
        font: 600 .88rem var(--mr-sans); box-shadow: 0 0.625rem 1.875rem rgba(0,0,0,.2); cursor: pointer; }
    .gd-rouvrir .gd-avatar { width: 2.125rem; height: 2.125rem; border-radius: 50%; }
    body.guide-mobile-ouvert .gd-rouvrir { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .gd, .gd-msg, body.avec-guide .app-content, .gd-halo, .gd-parcours li i { animation: none !important; transition: none !important; }
}

/* Le bouton « Une idée ? Un bug ? » vit en bas à droite (beta.css) : il ne
   croise plus le guide, qui n'a donc plus à le pousser. Sur téléphone il
   reste au-dessus du bouton qui rouvre le guide. */
@media (max-width: 900px) { body.avec-guide .mr-aide { bottom: 4.5rem; } }
.gd-saisie textarea { overflow: hidden; min-height: 1.5rem; }
.gd-saisie textarea::placeholder { color: var(--mr-text-muted); }
/* Cinq étapes dans un tiers d'écran : les noms s'abrègent, l'étape en cours prend la place. */
.gd-parcours li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-parcours li[data-etat="suivante"] { flex-grow: 2.2; }

/* L'en-tête du rail de Flair, aux traits du guide. */
.ch-rail-guide { width: 2.125rem; height: 2.125rem; border-radius: 0.6875rem; }
.ch-rail-guide i { width: 1.3125rem; height: 1.3125rem; }
.ch-rail-qui { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.ch-rail-qui strong { font-family: var(--mr-serif); font-size: 1.05rem; font-weight: 600; color: var(--mr-text-strong); }
.ch-rail-haut:has(.ch-rail-guide) { justify-content: flex-start; gap: 0.75rem; }
body.guide-mobile-ouvert .mr-aide { display: none; }

/* ── Flottant (Clem, 11/10/2026 : « plus flottant, comme la carte de Flair ») ──
   Le guide n'est plus collé au bord : une carte posée à 14 px des bords, arrondie,
   avec la lueur verte des cartes du hall. Le contenu se décale d'autant. */
@media (min-width: 901px) {
    :root { --gd-marge: 0.875rem; }
    .gd {
        left: var(--gd-marge); top: calc(var(--topbar-actuelle, 4rem) + var(--gd-marge)); bottom: var(--gd-marge);
        border: 1px solid var(--mr-border); border-radius: 1.625rem; overflow: hidden;
        background:
            radial-gradient(120% 60% at 15% 0%, rgba(122, 160, 120, .16), transparent 60%),
            var(--mr-surface-card);
        box-shadow: 0 1.875rem 3.75rem -1.25rem rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
    }
    body.avec-guide .app-content { margin-left: calc(var(--gd-l) + var(--gd-marge) * 2); }
    body.avec-guide.guide-reduit .app-content { margin-left: calc(var(--gd-reduit) + var(--gd-marge) * 2); }
    .gd-tete, .gd-parcours { border-bottom-color: rgba(127, 127, 127, .14); }
    .gd-msg--accueil { background: rgba(255, 255, 255, .035); }
    .gd-saisie { border-radius: 1.25rem; background: rgba(0, 0, 0, .12); }
    :root[data-theme="light"] .gd-saisie { background: var(--mr-surface); }
    /* Flair en conversation : son rail reste à sa place, collé, le guide flottant cède. */
}
/* Les étapes alignées sur une même ligne, quel que soit le libellé. */
.gd-parcours { align-items: start; }
.gd-parcours li { align-content: start; }
.gd-parcours a, .gd-parcours li > span { align-content: start; }

/* ── Le guide ne bouge, ne rétrécit et ne change jamais (Clem, 11/10/2026) ──
   Plus de bouton « réduire » sur ordinateur, un état réduit ancien est ignoré ;
   et sur Flair, la colonne de la conversation prend EXACTEMENT la forme de la
   carte du guide : même largeur, mêmes marges, même fond, même en-tête. */
@media (min-width: 901px) {
    .gd-reduire { display: none; }
    body.guide-reduit .gd { width: var(--gd-l); }
    body.guide-reduit .gd > :not(.gd-tete) { display: flex; }
    body.guide-reduit .gd-parcours { display: flex; }
    body.guide-reduit .gd-tete { flex-direction: row; padding: 1rem 1rem 0.875rem 1.125rem; border-bottom: 1px solid rgba(127, 127, 127, .14); }
    body.guide-reduit .gd-qui, body.guide-reduit #gdEffacer { display: grid; }
    body.avec-guide.guide-reduit .app-content { margin-left: calc(var(--gd-l) + var(--gd-marge) * 2); }

    /* La poignée est retirée du flux : deux colonnes, sinon le tableau tombe dans sa case de 0 px. */
    body.avec-guide .ch-travail { grid-template-columns: calc(var(--gd-l) + var(--gd-marge) * 2) minmax(0, 1fr) !important; }
    body.avec-guide .ch-poignee { display: none !important; }
    body.avec-guide .ch-rail {
        margin: var(--gd-marge); border: 1px solid var(--mr-border); border-radius: 1.625rem; overflow: hidden;
        background: radial-gradient(120% 60% at 15% 0%, rgba(122, 160, 120, .16), transparent 60%), var(--mr-surface-card);
        box-shadow: 0 1.875rem 3.75rem -1.25rem rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
    }
    body.avec-guide .ch-rail-haut { padding: 1rem 1rem 0.875rem 1.125rem; border-bottom-color: rgba(127, 127, 127, .14); }
    body.avec-guide .ch-rail-guide { width: 2.375rem; height: 2.375rem; border-radius: 0.75rem; }
    body.avec-guide .ch-rail-guide i { width: 1.5rem; height: 1.5rem; }
    body.avec-guide .ch-rail-qui strong { font-size: 1.15rem; }
    body.avec-guide .ch-rail-titre { font-size: .8rem; font-weight: 400; color: var(--mr-text-muted); }
    body.avec-guide .ch-rail .ch-saisie { margin: 0 0.875rem 0.875rem; border-radius: 1.25rem; }
}

/* Navigation douce : pendant qu'on va chercher l'écran suivant, l'actuel s'estompe. */
main.app-content { transition: opacity .2s ease; }
body.nav-en-cours main.app-content { opacity: .55; pointer-events: none; }
