/* Chat d'accueil en marque blanche : couleur du cabinet (--marque), téléphone d'abord. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/static/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900; font-style: normal; font-display: swap;
}

:root {
  --marque: #1f4e79;
  --fond: #f4f3ef;
  --carte: #ffffff;
  --encre: #15191f;
  --gris: #5b6270;
  --trait: #e2ded3;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }

.bandeau { background: #ffd400; color: #000; text-align: center; font: 600 .8125rem/1.35 var(--sans);
  padding: .5rem 1rem; border-bottom: 2px solid #000; }
.bandeau--pied { border-bottom: 0; border-top: 2px solid #000; }

.appli { flex: 1; width: min(100%, 40rem); margin: 0 auto; display: flex; flex-direction: column;
  background: var(--fond); }

.entete { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem; background: var(--marque); color: #fff; }
.pastille { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.18); font-weight: 700; font-size: .9rem; letter-spacing: .02em; }
.entete__nom { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.25; }
.entete__statut { margin: .1rem 0 0; font-size: .78rem; opacity: .85; }

.chat { flex: 1; display: flex; flex-direction: column; }
.fil { list-style: none; margin: 0; padding: 1rem .9rem .5rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.bulle { max-width: 86%; padding: .7rem .9rem; border-radius: 1.1rem; font-size: .97rem; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; animation: arrivee .25s ease both; }
.bulle--outil { align-self: flex-start; background: var(--carte); border: 1px solid var(--trait); border-bottom-left-radius: .35rem; }
.bulle--client { align-self: flex-end; background: var(--marque); color: #fff; border-bottom-right-radius: .35rem; }
.lien-notice { align-self: flex-start; font-size: .88rem; padding-left: .4rem; }
.lien-notice a { color: var(--marque); font-weight: 600; }
.fin { height: 1px; outline: none; scroll-margin-bottom: .5rem; }
@keyframes arrivee { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: none; } }

.saisie { position: sticky; bottom: 0; background: linear-gradient(to bottom, rgba(244,243,239,0), var(--fond) 22%);
  padding: .8rem .9rem calc(.9rem + env(safe-area-inset-bottom)); display: grid; gap: .6rem; }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; }
.choix { font: 600 .95rem/1.25 var(--sans); color: var(--marque); background: var(--carte);
  border: 1.5px solid var(--marque); border-radius: 999px; padding: .65rem 1rem; cursor: pointer; text-align: left;
  transition: background .15s ease, color .15s ease; }
.choix:hover, .choix:focus-visible { background: var(--marque); color: #fff; }
.ligne { display: flex; gap: .5rem; }
.ligne input { flex: 1; min-width: 0; font: 400 1rem/1.3 var(--sans); padding: .75rem .95rem; border-radius: 999px;
  border: 1.5px solid var(--trait); background: var(--carte); color: var(--encre); }
.ligne input:focus { outline: none; border-color: var(--marque); }
.envoyer { flex: none; font: 600 .95rem/1 var(--sans); color: #fff; background: var(--marque); border: 0;
  border-radius: 999px; padding: 0 1.15rem; cursor: pointer; }
.note { margin: 0; text-align: center; color: var(--gris); font-size: .88rem; }
.masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.htmx-request .envoyer, .htmx-request .choix { opacity: .6; }

@media (max-width: 480px) {
  .bandeau { font-size: .72rem; padding: .4rem .5rem; }
}
@media (prefers-reduced-motion: reduce) { .bulle { animation: none; } }

/* Notice d'information */
.notice { padding: 1.2rem 1.1rem 2rem; display: grid; gap: .9rem; }
.notice h2 { font-size: 1.05rem; margin: .6rem 0 0; }
.notice p, .notice li { color: #2a313b; }
.modele { background: #fff8d6; border: 1px solid #e8d27a; border-radius: .7rem; padding: .7rem .9rem; font-size: .9rem; }

/* Espace client (M3) */
.espace section { margin-bottom: 1.6rem; }
.retour { background: #e5efe9; border-radius: .5rem; padding: .6rem .8rem; font-weight: 600; }
.statut { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.statut__etape { padding-left: 1.4rem; position: relative; color: #6b7280; }
.statut__etape::before { content: ""; position: absolute; left: .2rem; top: .45rem; width: .6rem; height: .6rem; border-radius: 50%; border: 2px solid currentColor; }
.statut__etape--faite { color: inherit; font-weight: 600; }
.statut__etape--faite::before { background: var(--marque); border-color: var(--marque); }
.question { border: 1px solid var(--trait); border-radius: .8rem; padding: .8rem; margin-bottom: .7rem; display: grid; gap: .5rem; }
.question fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: .4rem; }
.question legend { font-weight: 600; margin-bottom: .3rem; }
.option { display: flex; gap: .5rem; align-items: center; }
.fait { font-size: .8rem; color: var(--marque); }
.pieces { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.piece { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .8rem; border-bottom: 1px solid var(--trait); padding: .4rem 0; }
.piece__etat { font-weight: 600; text-align: right; margin-left: auto; }
.piece--recue .piece__etat { color: var(--marque); }
.facultatif { color: #6b7280; font-size: .85rem; }
.depot { display: grid; gap: .7rem; }
.depot label { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
.depot label[hidden] { display: none; }
.depot select, .depot input[type=file] { font: 400 1rem/1.3 var(--sans); padding: .7rem .8rem; border: 1px solid #d5d9e0;
  border-radius: .7rem; background: #fff; width: 100%; box-sizing: border-box; }
.depot select:focus, .depot input[type=file]:focus { outline: 2px solid var(--marque); outline-offset: 1px; }
.depot input[type=file]::file-selector-button { font: 600 .9rem var(--sans); margin-right: .8rem; padding: .5rem .9rem;
  border: 0; border-radius: 999px; background: var(--marque); color: #fff; cursor: pointer; }
.retour--erreur { background: #fbe9e7; color: #8a1c0e; }
.lien { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.espace .envoyer { width: auto; height: auto; min-height: 2.75rem; padding: .7rem 1.2rem; border-radius: 999px; justify-self: start; }
.espace .bulle { white-space: pre-wrap; }

/* Mention d'environnement (INFRA.md §1) : discrète, sans bandeau jaune. */
.bandeau { background: transparent !important; color: #8a7f83 !important; border: 0 !important;
  font: 500 .72rem/1.3 var(--sans) !important; text-align: center; padding: .35rem 1rem !important;
  position: static !important; letter-spacing: .01em; }
.bandeau--pied { margin-top: 0 !important; padding: 1rem !important; }
.bandeau:empty { display: none; }

/* Typographie unique : Inter (OFL 1.1, auto-hébergée), titres serrés (D-063). */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
:root { --titre: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Inter", system-ui, sans-serif; }
body { font-family: var(--sans); font-feature-settings: "cv11", "ss01"; }
h1, h2, h3 { font-family: var(--titre); letter-spacing: -.035em; }
/* Réponse rédigée par l'assistant IA (D-067) : même bulle que les messages de l'outil. */
.bulle--ia { align-self: flex-start; background: var(--carte); border: 1px solid var(--trait); border-bottom-left-radius: .35rem; }

/* =======================================================================================
   Chat façon assistant IA moderne (D-068) : Inter, fond clair, réponses sans bulle avec
   avatar, messages du client en pastille grise, champ de saisie unique arrondi.
   ======================================================================================= */
:root { --fond: #ffffff; --carte: #ffffff; --encre: #18181b; --gris: #71717a; --trait: #e4e4e7;
  --doux: #f4f4f5; }
body { background: var(--fond); font-size: 15.5px; }
.appli { background: var(--fond); width: min(100%, 44rem); }
.entete { background: rgba(255,255,255,.86); color: var(--encre); border-bottom: 1px solid var(--trait);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: .8rem 1.1rem; }
.pastille { background: var(--marque); color: #fff; width: 2.4rem; height: 2.4rem; font-size: .82rem; }
.entete__nom { font-weight: 650; letter-spacing: -.01em; }
.entete__statut { color: var(--gris); opacity: 1; display: flex; align-items: center; gap: .4rem; }
.point-en-ligne { width: .45rem; height: .45rem; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

.fil { padding: 1.4rem 1.1rem .8rem; gap: 1.1rem; }
.bulle { max-width: 100%; padding: 0; border-radius: 0; font-size: 1rem; line-height: 1.6; animation: none; }
.bulle--outil, .bulle--ia { align-self: stretch; background: none; border: 0; position: relative;
  padding-left: 2.6rem; color: var(--encre); }
.bulle--outil::before, .bulle--ia::before { content: ""; position: absolute; left: 0; top: .1rem; width: 1.75rem;
  height: 1.75rem; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 45%), var(--marque); }
.bulle--outil + .bulle--outil::before, .bulle--outil + .bulle--ia::before,
.bulle--ia + .bulle--outil::before, .bulle--ia + .bulle--ia::before { visibility: hidden; }
.bulle--outil + .bulle--outil, .bulle--outil + .bulle--ia, .bulle--ia + .bulle--outil { margin-top: -.5rem; }
.bulle--client { max-width: 82%; padding: .65rem 1rem; border-radius: 1.3rem; background: var(--doux);
  color: var(--encre); border-bottom-right-radius: 1.3rem; }
.bulle--envoi { animation: arrivee .2s ease both; }
.mot { opacity: 0; animation: mot .35s ease forwards; }
@keyframes mot { from { opacity: 0; filter: blur(2px); } to { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { .mot { animation: none; opacity: 1; } }

.ecrit { align-self: flex-start; display: flex; gap: .3rem; padding: .55rem 0 .55rem 2.6rem; position: relative; }
.ecrit::before { content: ""; position: absolute; left: 0; top: .2rem; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--marque); animation: respire 1.4s ease-in-out infinite; }
.ecrit span { width: .45rem; height: .45rem; border-radius: 50%; background: #a1a1aa; animation: saut 1.2s infinite ease-in-out; }
.ecrit span:nth-child(2) { animation-delay: .15s; } .ecrit span:nth-child(3) { animation-delay: .3s; }
@keyframes saut { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-.3rem); opacity: 1; } }
@keyframes respire { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.lien-notice { padding-left: 2.6rem; }
.saisie { background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 28%); padding: .8rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); }
.saisie--attente { opacity: .45; pointer-events: none; transition: opacity .2s; }
.choix { font: 500 .93rem/1.25 var(--sans); color: var(--encre); background: #fff; border: 1px solid var(--trait);
  padding: .6rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.choix:hover, .choix:focus-visible { background: var(--doux); color: var(--encre); border-color: #d4d4d8; }
.ligne { align-items: center; gap: 0; background: #fff; border: 1px solid var(--trait); border-radius: 1.6rem;
  padding: .35rem .35rem .35rem 1rem; box-shadow: 0 6px 24px -10px rgba(0,0,0,.18); }
.ligne:focus-within { border-color: #a1a1aa; }
.ligne input { border: 0; padding: .55rem 0; background: transparent; border-radius: 0; }
.ligne input:focus { outline: none; }
.envoyer { border-radius: 999px; }
.envoyer--icone { width: 2.5rem; height: 2.5rem; padding: 0; display: grid; place-items: center; background: var(--encre); }
.envoyer--icone svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.envoyer--icone:hover { background: var(--marque); }
.bandeau { background: #fff !important; }

/* =======================================================================================
   Refonte côté client (maquettes validées le 02/11/2026) : fond gris clair, cartes
   blanches, logo carré à la couleur du cabinet, une action mise en avant à la fois.
   ======================================================================================= */
:root { --fond: #f5f6f8; --trait: #e4e7ec; --gris: #4a5260; --doux: #eef2f7; --vert: #1e4d33; --vert-fond: #e8f2ec; }
body, .appli { background: var(--fond); }
.entete { background: #fff; }
.pastille { border-radius: .75rem; }

/* Chat : progression, mention IA, bulles. */
.progression { display: flex; align-items: center; gap: .7rem; padding: .6rem 1.1rem; background: #fff;
  border-bottom: 1px solid var(--trait); font-size: .78rem; color: var(--gris); }
.progression__barre { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; }
.progression__barre span { height: .25rem; border-radius: .2rem; background: #d5dae1; }
.progression__barre span.fait { background: var(--marque); }
.bulle--outil, .bulle--ia { align-self: flex-start; max-width: 86%; padding: .75rem .9rem; background: #fff;
  border: 1px solid var(--trait); border-radius: 1rem 1rem 1rem .3rem; line-height: 1.5; }
.bulle--outil::before, .bulle--ia::before { display: none; }
.bulle--outil + .bulle--outil, .bulle--outil + .bulle--ia, .bulle--ia + .bulle--outil { margin-top: 0; }
.bulle--client { background: var(--marque); color: #fff; border-radius: 1rem 1rem .3rem 1rem; }
.bulle[data-code="accueil"] { max-width: 100%; align-self: stretch; background: var(--doux); border: 0;
  border-radius: .75rem; font-size: .84rem; color: #2d3440; }
.lien-notice { padding-left: .4rem; }
.ecrit { padding-left: .4rem; } .ecrit::before { display: none; }
.choix { color: var(--marque); border: 1px solid var(--marque); min-height: 2.75rem; font-weight: 500; }
.choix:hover, .choix:focus-visible { background: var(--marque); color: #fff; border-color: var(--marque); }
.boutons--creneaux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.boutons--creneaux .choix { border-radius: .75rem; text-align: center; color: var(--encre); border-color: #c9cfd8; font-weight: 600; }
.boutons--creneaux .choix--autre { grid-column: 1 / -1; border: 0; background: none; box-shadow: none;
  color: var(--marque); text-decoration: underline; font-weight: 500; }
.saisie { background: linear-gradient(to bottom, rgba(245,246,248,0), var(--fond) 28%); }
.envoyer--icone { background: var(--marque); }

/* Espace client. */
.espace { display: grid; gap: .9rem; padding: 1.1rem 1rem 2rem; }
.espace section { margin: 0; }
.carte-espace { background: #fff; border: 1px solid var(--trait); border-radius: 1rem; padding: 1rem 1.1rem; }
.carte-espace h2 { margin: 0 0 .6rem; font-size: 1rem; letter-spacing: -.01em; }
.avancement__barre { display: flex; gap: .25rem; margin-bottom: .8rem; }
.avancement__segment { flex: 1; height: .35rem; border-radius: .2rem; background: #d5dae1; }
.avancement__segment--fait { background: var(--marque); }
.avancement .statut { font-size: .9rem; }
.a-faire { background: var(--marque); color: #fff; border: 0; display: grid; gap: .5rem; }
.a-faire__surtitre { margin: 0; font-size: .82rem; opacity: .85; }
.a-faire__titre.a-faire__titre { margin: 0; font-size: 1.15rem; color: #fff; }
.a-faire__bouton { justify-self: start; min-height: 2.75rem; display: inline-flex; align-items: center; padding: 0 1.1rem;
  border-radius: 999px; background: #fff; color: var(--marque); font-weight: 600; text-decoration: none; }
.pieces { gap: 0; margin: 0; }
.piece { align-items: center; flex-wrap: nowrap; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #eef0f3; }
.piece:last-child { border-bottom: 0; }
.piece__coche { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px dashed #9aa3b0; }
.piece--recue .piece__coche { border: 0; background: var(--vert-fond) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e4d33' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / .85rem no-repeat; }
.piece__nom { flex: 1; font-size: .93rem; }
.piece__etat { font-size: .8rem; color: var(--vert); text-align: right; }
.piece--recue .piece__etat { color: var(--vert); }
.piece__ajouter { min-height: 2.75rem; display: inline-flex; align-items: center; font-weight: 600; color: var(--marque); }
.facultatives summary, #questionnaire summary { cursor: pointer; font-size: .88rem; color: var(--gris); padding: .5rem 0; list-style-position: inside; }
#questionnaire summary { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; color: var(--encre); }
#questionnaire summary h2 { display: inline; margin: 0; }
.discret { color: var(--gris); font-size: .82rem; font-weight: 400; }
.types { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; }
.types legend { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.depot label.type { display: flex; flex-direction: row; align-items: center; gap: .7rem; min-height: 3rem; padding: 0 .9rem;
  border: 1px solid #c9cfd8; border-radius: .75rem; font-weight: 500; cursor: pointer; }
.depot label.type--choisi { border: 2px solid var(--marque); background: var(--doux); font-weight: 600; }
.type input { accent-color: var(--marque); width: 1.1rem; height: 1.1rem; }
.depot label.fichier { position: relative; display: grid; justify-items: center; gap: .3rem; padding: 1.4rem 1rem;
  border: 2px dashed #9aa3b0; border-radius: 1rem; text-align: center; cursor: pointer; background: #fafbfc; }
.fichier svg { width: 2rem; height: 2rem; fill: none; stroke: var(--marque); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fichier__titre { font-weight: 600; color: var(--marque); overflow-wrap: anywhere; }
.fichier__aide { font-size: .8rem; color: var(--gris); font-weight: 400; }
.fichier input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.fichier:focus-within { outline: 2px solid var(--marque); outline-offset: 2px; }
.envoyer--large { width: 100%; min-height: 3.2rem; justify-self: stretch; }
.espace .envoyer--large { width: 100%; }
.retour { background: var(--vert-fond); color: var(--vert); border-radius: .75rem; }
.relances { text-align: center; font-size: .85rem; }
@media (min-width: 900px) {
  .appli:has(.espace) { width: min(100%, 72rem); }
  .espace { grid-template-columns: 20rem minmax(0, 1fr); align-items: start; padding: 2rem; }
  .espace > .avancement, .espace > .a-faire, .espace > section:has(#t-messages) { grid-column: 1; }
  .espace > #pieces, .espace > #depot, .espace > #questionnaire, .espace > .relances { grid-column: 2; }
  .espace > .avancement { grid-row: 1 / span 1; }
}
.entete { flex-wrap: wrap; }
.entete .progression { flex: 1 1 100%; padding: .55rem 0 0; margin-top: .55rem; border-bottom: 0; border-top: 1px solid var(--trait); background: none; }
.a-faire p.a-faire__surtitre { color: #fff; }
.piece { flex-wrap: wrap; }
.piece__nom { flex: 1 1 55%; min-width: 0; }
.piece__etat { flex: 0 1 auto; margin-left: auto; }
.facultatives .types { margin-top: .5rem; }
@media (min-width: 900px) {
  .espace > .avancement { grid-row: 1; } .espace > .a-faire { grid-row: 2; }
  .espace > section:has(#t-messages) { grid-row: 3; }
  .espace > #pieces { grid-row: 1 / span 2; } .espace > #depot { grid-row: 3 / span 3; }
  .espace > .relances { grid-row: 6; } .espace > #questionnaire { grid-row: 7; }
}

/* Documents joints dans le chat et lien de suivi (D-105). */
.depot { display: grid; grid-template-columns: 1fr; gap: .45rem; background: #fff; border: 1px solid var(--trait); border-radius: 1rem; padding: .7rem; }
.depot select { font: inherit; padding: .55rem .6rem; border: 1px solid var(--trait); border-radius: .6rem; background: #fff; }
.depot__fichier { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.depot__fichier input { font-size: .85rem; max-width: 100%; }
.suivi { text-align: center; }
.lien-discret { background: none; border: 0; color: var(--marque); text-decoration: underline; font: inherit; font-size: .88rem; cursor: pointer; padding: .2rem; }
