/* NOVEA Estimateur — assistant conversationnel
   Charte NOVEA : noir, blanc, gris, jaune #fec930 */
:root {
  --noir: #111111;
  --jaune: #fec930;
  --blanc: #ffffff;
  --gris-fond: #f2f2f2;
  --gris-bulle: #f1f1f1;
  --gris-ligne: #dcdcdc;
  --gris-texte: #6b6b6b;
  --rouge: #c0362c;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--gris-fond); color: var(--noir);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column; -webkit-text-size-adjust: 100%;
}
a { color: var(--noir); }
button { font: inherit; color: inherit; }

/* ---------- Bandeau ---------- */
.topbar {
  flex: none; height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--noir); color: var(--blanc);
}
.brand { color: var(--blanc); text-decoration: none; font-size: 17px; letter-spacing: .14em; text-transform: uppercase; }
.brand b { font-weight: 800; }
.brand span { color: var(--jaune); font-weight: 400; letter-spacing: .08em; text-transform: none; }
.tel { display: inline-flex; align-items: center; gap: 8px; background: var(--jaune); color: var(--noir); text-decoration: none; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; }
@media (max-width: 420px) { .tel-num { display: none; } .tel { padding: 8px 12px; } }

/* ---------- Fenêtre de discussion ---------- */
.chat {
  flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--blanc);
  width: 100%; max-width: 760px; margin: 0 auto;
}
@media (min-width: 800px) {
  .chat { margin: 20px auto; border-radius: 20px; box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 18px 50px rgba(0,0,0,.08); overflow: hidden; }
}
.chat-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #ededed; }
.avatar, .av {
  flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--jaune); color: var(--noir); font-weight: 800;
}
.avatar { width: 42px; height: 42px; font-size: 18px; }
.who { flex: 1; min-width: 0; }
.who strong { display: block; font-size: 16px; }
.who span { color: var(--gris-texte); font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2fb36b; margin-right: 2px; vertical-align: 1px; }
.restart { background: none; border: 1px solid var(--gris-ligne); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--gris-texte); cursor: pointer; }
.restart:hover { border-color: var(--noir); color: var(--noir); }
@media (max-width: 480px) { .who .long, .restart .lbl { display: none; } .restart { padding: 6px 11px; font-size: 16px; } }
.progress { flex: none; height: 3px; background: #eeeeee; }
.progress span { display: block; height: 100%; width: 0; background: var(--jaune); transition: width .4s ease; }

/* ---------- Messages ---------- */
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
@media (min-width: 800px) { .messages { padding: 24px 26px 12px; } }
.msg { display: flex; gap: 8px; align-items: flex-end; margin: 4px 0; max-width: 88%; animation: pop .22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .av { width: 30px; height: 30px; font-size: 13px; }
.msg.bot + .msg.bot .av { visibility: hidden; }
.msg.me + .msg.bot, .msg.bot + .msg.me { margin-top: 14px; }
.bubble { padding: 11px 15px; border-radius: 20px; overflow-wrap: anywhere; }
.bubble p { margin: 0; }
.bubble p + p { margin-top: 6px; }
.bubble .help { color: var(--gris-texte); font-size: 14px; }
.bubble .help a { color: var(--gris-texte); }
.msg.bot .bubble { background: var(--gris-bulle); border-bottom-left-radius: 6px; }
.msg.bot.small .bubble { background: transparent; border: 1px solid #ececec; color: var(--gris-texte); font-size: 13px; }
.msg.bot.small .bubble .help { font-size: 13px; }
.msg.me { margin-left: auto; flex-direction: column; align-items: flex-end; gap: 2px; }
.msg.me .bubble { background: var(--noir); color: var(--blanc); border-bottom-right-radius: 6px; }
.edit { background: none; border: 0; color: var(--gris-texte); font-size: 11.5px; text-decoration: underline; cursor: pointer; padding: 0 4px; opacity: .7; }
.edit:hover { opacity: 1; color: var(--noir); }
.is-done .edit { display: none; }

.typing .bubble { padding: 14px 16px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; animation: blink 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Carte de résultat */
.msg.bot.wide { max-width: 100%; width: 100%; }
.msg.bot.wide .bubble { flex: 1; background: var(--noir); color: var(--blanc); border-radius: 20px 20px 20px 6px; padding: 20px 22px; }
.result p { margin: 0; }
.r-lab { color: #bdbdbd; font-size: 14px; }
.r-range { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: clamp(26px, 7vw, 36px); font-weight: 800; color: var(--jaune); margin: 4px 0 16px !important; letter-spacing: -.01em; }
.r-range small { font-size: 16px; font-weight: 400; color: #bdbdbd; }
.gauge { position: relative; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #5a4a1a, var(--jaune) 50%, #5a4a1a); margin-bottom: 12px; }
.gauge i { position: absolute; left: 50%; top: -6px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--blanc); border: 4px solid var(--jaune); }
.r-mid { font-size: 15px; color: #e6e6e6; }
.r-mid b { color: var(--blanc); }
.r-meta { font-size: 13px; color: #a8a8a8; margin-top: 6px !important; }

/* ---------- Zone de réponse ---------- */
.composer { flex: none; position: relative; border-top: 1px solid #ededed; background: var(--blanc); padding: 12px 16px calc(10px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { .composer { padding: 14px 26px 12px; } }
.composer-body:empty { min-height: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 38vh; overflow-y: auto; padding: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--gris-ligne); background: var(--blanc); color: var(--noir);
  border-radius: 999px; padding: 10px 16px; font-size: 15px; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: border-color .12s, background .12s, transform .08s;
}
.chip:hover { border-color: var(--noir); }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--jaune); border-color: var(--jaune); font-weight: 600; }
.multi-on::before, .chip.on[aria-pressed="true"]::before { content: "✓"; }
.chip.other { border-style: dashed; color: var(--gris-texte); }
.chip.other:hover { color: var(--noir); }
.chip.ghost { border-color: transparent; color: var(--gris-texte); text-decoration: underline; }
.chip.primary { background: var(--jaune); border-color: var(--jaune); font-weight: 700; }
.chip.primary:hover { border-color: var(--noir); }
.hint { margin: 0 0 8px; font-size: 13px; color: var(--gris-texte); }
.actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.send-txt { border: 0; background: var(--jaune); color: var(--noir); font-weight: 700; border-radius: 999px; padding: 11px 22px; cursor: pointer; }
.send-txt[disabled] { opacity: .45; cursor: default; }

.row { display: flex; gap: 8px; align-items: center; }
.field { flex: 1; min-width: 0; display: flex; align-items: center; border: 1.5px solid var(--gris-ligne); border-radius: 999px; background: var(--blanc); transition: border-color .12s; }
.field:focus-within { border-color: var(--noir); }
.input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 18px; font-size: 16px; color: var(--noir); outline: none; }
textarea.input { resize: none; min-height: 48px; }
.unit { padding: 0 18px 0 4px; color: var(--gris-texte); font-weight: 600; }
.send { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--jaune); color: var(--noir); font-size: 18px; cursor: pointer; display: grid; place-items: center; }
.send:hover { background: #f5bd17; }
.err { color: var(--rouge); font-size: 13.5px; margin: 6px 6px 0; min-height: 0; }
.err:empty { display: none; }
.back { background: none; border: 0; color: var(--gris-texte); font-size: 13.5px; text-decoration: underline; cursor: pointer; padding: 4px 2px 8px; }
.back:hover { color: var(--noir); }

.suggest {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 5; background: var(--blanc);
  border: 1px solid #e3e3e3; border-radius: 16px; box-shadow: 0 -8px 30px rgba(0,0,0,.10); padding: 6px; max-height: 50vh; overflow-y: auto;
}
.sg { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.sg strong { display: block; font-weight: 600; }
.sg span { font-size: 13px; color: var(--gris-texte); }
.sg:hover, .sg.on { background: var(--gris-fond); }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 2px 0; font-size: 12px; color: var(--gris-texte); }
.foot a { color: var(--gris-texte); margin-left: auto; }
.saved { color: #2f8a55; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.noscript { padding: 20px; text-align: center; }

/* Pages simples (mentions) */
body.page-simple { display: block; }
.wrap { max-width: 760px; margin: 0 auto; padding: 22px 16px 40px; }
.card { background: var(--blanc); border-radius: 18px; padding: 28px; }
.page h1 { font-size: 26px; margin-top: 0; }
.page h1::after { content: ""; display: block; width: 48px; height: 4px; background: var(--jaune); margin-top: 10px; border-radius: 2px; }
.page h2 { font-size: 18px; margin-top: 26px; }

/* Analyse en cours (pendant le calcul) */
.msg.bot.wide-soft { max-width: 100%; width: 100%; }
.msg.bot.wide-soft .bubble { flex: 1; background: var(--blanc); border: 1.5px solid #ececec; border-radius: 20px 20px 20px 6px; padding: 16px 18px; }
.analyse p { margin: 0 0 10px; }
.a-titre { font-weight: 700; font-size: 15px; }
.analyse ul { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.analyse li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: #a3a3a3; transition: color .2s; }
.analyse li.cur, .analyse li.ok { color: var(--noir); }
.analyse .st { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #dedede; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.analyse li.cur .st { border-color: var(--jaune); border-right-color: transparent; animation: tourne .8s linear infinite; }
.analyse li.ok .st { background: var(--jaune); border-color: var(--jaune); }
.analyse li.ok .st::after { content: "✓"; color: var(--noir); }
.a-bar { height: 6px; background: #efefef; border-radius: 99px; overflow: hidden; }
.a-bar i { display: block; height: 100%; width: 0; background: var(--jaune); border-radius: 99px; transition: width .6s ease; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .analyse li.cur .st { animation: none; } }
