/* Assistant virtuel ESS : bouton flottant et fenêtre de discussion. Couleurs de la charte du site. */
.ess-a {
  --a-night: #0f1a24; --a-paper: #f6f7f9; --a-card: #ffffff; --a-line: #d8dee4; --a-muted: #5b6b7a;
  --a-blue: #2563eb; --a-blue-dark: #1d4ed8; --a-soft: #e8ecf0; --a-error: #c0352b;
  --a-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --a-display: Archivo, "IBM Plex Sans", system-ui, sans-serif;
  font-family: var(--a-font); font-size: 15px; line-height: 1.5; color: var(--a-night);
}
.ess-a *, .ess-a *::before, .ess-a *::after { box-sizing: border-box; }

.ess-a-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 14px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 26px; background: var(--a-night); color: #fff;
  font: 600 15px/1 var(--a-font); cursor: pointer;
  box-shadow: 0 8px 24px rgba(15,26,36,.22), 0 2px 6px rgba(15,26,36,.18);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.ess-a-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,26,36,.26); }
.ess-a-launcher:focus-visible, .ess-a button:focus-visible, .ess-a a:focus-visible, .ess-a input:focus-visible, .ess-a textarea:focus-visible {
  outline: 3px solid var(--a-blue); outline-offset: 2px;
}
.ess-a-launcher[hidden] { display: none; }
.ess-a-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--a-blue); flex: none; }
.ess-a-mark svg { width: 16px; height: 16px; }
.ess-a-stripe { display: flex; height: 3px; }
.ess-a-stripe i { flex: 1; }
.ess-a-stripe i:nth-child(1) { background: #e5484d; } .ess-a-stripe i:nth-child(2) { background: #f5c518; }
.ess-a-stripe i:nth-child(3) { background: #3b82f6; } .ess-a-stripe i:nth-child(4) { background: #b0793f; }
.ess-a-stripe i:nth-child(5) { background: #22c55e; } .ess-a-stripe i:nth-child(6) { background: #a855f7; }

.ess-a-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483001;
  display: flex; flex-direction: column; width: 400px; height: min(640px, calc(100vh - 40px));
  background: var(--a-paper); border: 1px solid var(--a-line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15,26,36,.28), 0 4px 12px rgba(15,26,36,.12);
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}
.ess-a-panel.is-open { opacity: 1; transform: none; }
.ess-a-panel[hidden] { display: none; }

.ess-a-head { background: var(--a-night); color: #fff; }
.ess-a-head-row { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 16px; }
.ess-a-head h2 { margin: 0; font: 700 16px/1.25 var(--a-display); letter-spacing: -.01em; color: #fff; }
.ess-a-head p { margin: 2px 0 0; font-size: 12.5px; color: #9fb0bf; }
.ess-a-head-txt { flex: 1; min-width: 0; }
.ess-a-icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 10px;
  background: transparent; color: #fff; cursor: pointer;
}
.ess-a-icon-btn:hover { background: rgba(255,255,255,.1); }
.ess-a-icon-btn svg { width: 20px; height: 20px; }

.ess-a-notice { margin: 0; padding: 9px 16px; font-size: 12.5px; color: var(--a-muted); background: var(--a-card); border-bottom: 1px solid var(--a-line); }

.ess-a-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ess-a-msg { max-width: 88%; padding: 10px 13px; border-radius: 12px; white-space: pre-line; overflow-wrap: anywhere; animation: ess-a-in .16s ease both; }
.ess-a-msg.bot { align-self: flex-start; background: var(--a-card); border: 1px solid var(--a-line); border-top-left-radius: 4px; }
.ess-a-msg.user { align-self: flex-end; background: var(--a-blue); color: #fff; border-top-right-radius: 4px; }
.ess-a-msg a { color: var(--a-blue-dark); font-weight: 600; }
.ess-a-msg .ess-a-cond { display: block; margin-top: 8px; padding: 8px 10px; border-left: 3px solid #f5c518; background: #fdf8e4; border-radius: 6px; font-size: 13.5px; }
.ess-a-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes ess-a-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.ess-a-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.ess-a-chips:empty { display: none; }
.ess-a-chip {
  min-height: 38px; padding: 7px 13px; border: 1px solid var(--a-blue); border-radius: 19px; background: var(--a-card);
  color: var(--a-blue-dark); font: 600 14px/1.3 var(--a-font); cursor: pointer; text-align: left;
  transition: background .12s ease, color .12s ease;
}
.ess-a-chip:hover { background: var(--a-blue); color: #fff; }
.ess-a-chip.secondary { border-color: var(--a-line); color: var(--a-night); }
.ess-a-chip.secondary:hover { background: var(--a-soft); color: var(--a-night); }

.ess-a-fiche { align-self: stretch; padding: 12px 14px; background: var(--a-card); border: 1px solid var(--a-line); border-radius: 12px; font-size: 14px; animation: ess-a-in .16s ease both; }
.ess-a-fiche h3 { margin: 0 0 8px; font: 700 14.5px/1.3 var(--a-display); }
.ess-a-fiche dl { display: grid; grid-template-columns: 112px 1fr; gap: 4px 10px; margin: 0; }
.ess-a-fiche dt { color: var(--a-muted); font-size: 13px; }
.ess-a-fiche dd { margin: 0; overflow-wrap: anywhere; }
.ess-a-fiche .ess-a-why { margin: 10px 0 0; font-size: 13px; color: var(--a-muted); }
.ess-a-consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13.5px; }
.ess-a-consent input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--a-blue); }
.ess-a-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ess-a-btn { min-height: 40px; padding: 8px 16px; border: 0; border-radius: 10px; background: var(--a-blue); color: #fff; font: 600 14px/1.2 var(--a-font); cursor: pointer; }
.ess-a-btn:hover { background: var(--a-blue-dark); }
.ess-a-btn[disabled] { opacity: .55; cursor: not-allowed; }
.ess-a-btn.ghost { background: transparent; color: var(--a-night); border: 1px solid var(--a-line); }
.ess-a-btn.ghost:hover { background: var(--a-soft); }
.ess-a-error { color: var(--a-error); font-size: 13.5px; margin: 8px 0 0; }

.ess-a-form { display: flex; gap: 8px; padding: 10px 12px; background: var(--a-card); border-top: 1px solid var(--a-line); }
.ess-a-form textarea {
  flex: 1; min-height: 42px; max-height: 120px; resize: none; padding: 10px 12px; border: 1px solid #9aa8b5; border-radius: 10px;
  font: 16px/1.35 var(--a-font); color: var(--a-night); background: #fff;
}
.ess-a-send { display: grid; place-items: center; width: 44px; height: 42px; flex: none; border: 0; border-radius: 10px; background: var(--a-blue); color: #fff; cursor: pointer; }
.ess-a-send:hover { background: var(--a-blue-dark); }
.ess-a-send svg { width: 20px; height: 20px; }
.ess-a-foot { margin: 0; padding: 7px 14px 9px; font-size: 12px; color: var(--a-muted); background: var(--a-card); text-align: center; }
.ess-a-foot a { color: var(--a-muted); }

.ess-a-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--a-card); border: 1px solid var(--a-line); border-radius: 12px; }
.ess-a-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9aa8b5; animation: ess-a-dot 1s infinite ease-in-out; }
.ess-a-typing i:nth-child(2) { animation-delay: .15s; } .ess-a-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ess-a-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

@media (max-width: 560px) {
  .ess-a-launcher { right: 14px; bottom: 14px; height: 52px; width: 52px; padding: 0; justify-content: center; border-radius: 50%; }
  .ess-a-launcher .ess-a-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ess-a-launcher .ess-a-mark { width: 30px; height: 30px; }
  .ess-a-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ess-a-launcher, .ess-a-panel, .ess-a-msg, .ess-a-fiche { transition: none; animation: none; }
  .ess-a-log { scroll-behavior: auto; }
  .ess-a-typing i { animation: none; opacity: .7; }
}
@media print { .ess-a { display: none; } }
.ess-a-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.ess-a-field label { font-size: 13px; font-weight: 600; }
.ess-a-field input { height: 42px; padding: 8px 11px; border: 1px solid #9aa8b5; border-radius: 9px; font: 16px/1.3 var(--a-font); color: var(--a-night); background: #fff; }
.ess-a-field input:disabled { background: var(--a-soft); color: var(--a-muted); }
