/* Démo v4 : tous les styles sont limités à #demo. */
#demo {
  --v4d-ink: #102c40;
  --v4d-muted: #405d61;
  --v4d-accent: #347a75;
  --v4d-line: #cbdcd7;
  background: #f2f6f2;
  color: var(--v4d-ink);
  padding: clamp(76px, 8vw, 120px) 0;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
#demo *, #demo *::before, #demo *::after { box-sizing: border-box; }
#demo [hidden] { display: none !important; }
#demo .v4d__wrap { width: min(1380px, 89%); margin: 0 auto; }
#demo .v4d__heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: clamp(30px, 7vw, 90px);
  margin-bottom: 34px;
}
#demo .v4d__eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: #316e6a;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
}
#demo .v4d__eyebrow span { display: block; width: 25px; height: 2px; background: #4baba4; flex: none; }
#demo h2 {
  margin: 0;
  color: var(--v4d-ink);
  font: 400 clamp(38px, 4.1vw, 57px)/1.13 "Playfair Display", Georgia, serif;
  letter-spacing: -.04em;
}
#demo h2 em { color: #4a8480; font-weight: 400; }
#demo .v4d__intro { max-width: 390px; margin: 0 0 4px; color: var(--v4d-muted); font-size: 17px; }
#demo .v4d__disclaimer {
  border-left: 3px solid #4c9d96;
  margin: 0 0 28px;
  padding: 14px 19px;
  background: #e7f1ed;
  color: #294c50;
}
#demo .v4d__layout {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  align-items: stretch;
  border: 1px solid var(--v4d-line);
  box-shadow: 0 18px 55px rgba(16, 44, 64, .07);
  background: #fff;
}
#demo .v4d__settings { min-width: 0; padding: clamp(26px, 3.6vw, 52px); }
#demo .v4d__label { margin: 0 0 12px; color: #397a76; font-size: 16px; font-weight: 700; }
#demo .v4d__settings h3 {
  margin: 0;
  color: var(--v4d-ink);
  font: 400 clamp(29px, 2.6vw, 38px)/1.2 "Playfair Display", Georgia, serif;
  letter-spacing: -.025em;
}
#demo .v4d__help { max-width: 430px; margin: 14px 0 24px; color: var(--v4d-muted); }
#demo .v4d__sectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#demo .v4d__sector,
#demo .v4d__replay,
#demo .v4d__pause {
  font: 700 16px/1.35 "DM Sans", Arial, sans-serif;
  cursor: pointer;
  min-height: 52px;
  border-radius: 0;
}
#demo .v4d__sector {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid #b8cdc7;
  background: #fff;
  color: #173c49;
  padding: 12px 14px;
  text-align: left;
  overflow-wrap: anywhere;
}
#demo .v4d__sector:hover { border-color: #327d77; background: #edf7f3; }
#demo .v4d__sector[aria-pressed="true"] { background: #dceee8; border-color: #267b73; box-shadow: inset 0 0 0 1px #267b73; }
#demo .v4d__sector-number { color: #376e6a; font-weight: 600; }
#demo .v4d__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
#demo .v4d__replay {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 18px;
  border: 1px solid #102f41;
  background: #102f41;
  color: #fff;
}
#demo .v4d__replay:hover { background: #21535a; border-color: #21535a; }
#demo .v4d__pause { padding: 13px 16px; border: 1px solid #8daea7; background: #fff; color: #204f4e; }
#demo .v4d__pause:hover:not(:disabled) { background: #e9f4ef; }
#demo .v4d__pause:disabled { color: #536965; border-color: #c7d4cf; background: #f1f4f2; cursor: default; }
#demo button:focus-visible, #demo .v4d__messages:focus-visible { outline: 3px solid #287e78; outline-offset: 3px; }
#demo .v4d__human-note { display: flex; align-items: start; gap: 14px; border-top: 1px solid #d9e6e1; margin-top: 32px; padding-top: 22px; color: #365a5b; }
#demo .v4d__human-note p { margin: 0; }
#demo .v4d__note-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid #9dc2bb; color: #347b75; }
#demo .v4d__conversation { min-width: 0; background: #f9fbf9; border-left: 1px solid var(--v4d-line); display: flex; flex-direction: column; }
#demo .v4d__conversation-head { display: flex; align-items: center; gap: 14px; padding: 24px clamp(22px, 3vw, 40px); background: #102c40; color: #fff; }
#demo .v4d__avatar { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border: 1px solid #699c99; background: #204c55; color: #bde5de; }
#demo .v4d__avatar svg { width: 24px; height: 24px; }
#demo .v4d__conversation-identity { min-width: 0; }
#demo .v4d__conversation-identity p { margin: 0; color: #c1dcd8; font-size: 16px; }
#demo .v4d__conversation-identity h3 { margin: 0; color: #fff; font: 700 18px/1.35 "DM Sans", Arial, sans-serif; }
#demo .v4d__badge { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; border: 1px solid #719b98; padding: 5px 10px; color: #e8f6f2; font-weight: 700; white-space: nowrap; }
#demo .v4d__badge span { width: 8px; height: 8px; background: #8bd4c9; border-radius: 50%; }
#demo .v4d__conversation-body { flex: 1; padding: 24px clamp(22px, 3vw, 40px) 20px; }
#demo .v4d__conversation-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; border-bottom: 1px solid #d7e5e0; padding-bottom: 14px; color: #395f5d; font-weight: 700; }
#demo .v4d__conversation-meta p { margin: 0; }
#demo .v4d__fallback, #demo .v4d__waiting { margin: 22px 0; color: #405f61; }
#demo .v4d__messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 350px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 22px 4px 22px 0;
  list-style: none;
  scrollbar-color: #9fbeb7 #e6efeb;
}
#demo .v4d__message { max-width: 89%; animation: v4d-appear .2s ease-out both; }
#demo .v4d__message--client { align-self: flex-end; }
#demo .v4d__message--ai { align-self: flex-start; }
#demo .v4d__message-label { margin: 0 0 5px; color: #41625f; font-size: 16px; font-weight: 700; }
#demo .v4d__message--client .v4d__message-label { text-align: right; }
#demo .v4d__message-text { margin: 0; padding: 12px 15px; border: 1px solid #cadbd5; background: #fff; color: #173849; overflow-wrap: anywhere; }
#demo .v4d__message--client .v4d__message-text { border-color: #c5dfd5; background: #e3f1eb; }
#demo .v4d__progress { display: block; appearance: none; width: 100%; height: 4px; border: 0; margin: 4px 0 10px; color: #3c9990; background: #dae8e2; }
#demo .v4d__progress::-webkit-progress-bar { background: #dae8e2; }
#demo .v4d__progress::-webkit-progress-value { background: #3c9990; }
#demo .v4d__progress::-moz-progress-bar { background: #3c9990; }
#demo .v4d__status { margin: 0; color: #405f5d; }
#demo .v4d__conversation-foot { display: flex; justify-content: center; gap: 13px; flex-wrap: wrap; border-top: 1px solid #d7e5e0; padding: 14px 20px; color: #395e5c; font-weight: 700; }
#demo .v4d__safety { margin: 24px 0 0; color: #405d61; }
@keyframes v4d-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) {
  #demo .v4d__wrap { width: 92%; }
  #demo .v4d__heading { display: block; }
  #demo .v4d__intro { max-width: 650px; margin-top: 22px; }
  #demo .v4d__layout { grid-template-columns: 1fr; }
  #demo .v4d__conversation { border-left: 0; border-top: 1px solid var(--v4d-line); }
}
@media (max-width: 650px) {
  #demo .v4d__wrap { width: calc(100% - 40px); }
  #demo h2 { font-size: clamp(34px, 9vw, 42px); }
  #demo .v4d__settings { padding: 26px 20px; }
  #demo .v4d__conversation-head { padding: 20px; }
  #demo .v4d__conversation-body { padding: 20px; }
  #demo .v4d__messages { height: 330px; }
  #demo .v4d__message { max-width: 96%; }
}
@media (max-width: 390px) {
  #demo .v4d__sectors { grid-template-columns: 1fr; }
  #demo .v4d__actions { align-items: stretch; flex-direction: column; }
  #demo .v4d__conversation-head { flex-wrap: wrap; }
  #demo .v4d__badge { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #demo .v4d__message { animation: none; }
}
