/* Conforme.QC : clavardage IA (widget). Couleurs : variables de style.css. Bouton en bas à GAUCHE (#toTop est à droite). */
.cqc { font: 400 1rem/1.5 var(--f-body); color: var(--text); }
.cqc-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.cqc-launch { position: fixed; z-index: 40; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink); font: 700 .98rem/1 var(--f-display); cursor: pointer;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,.55); }
.cqc-launch:hover { background: var(--accent-hover); }
.cqc-launch svg { width: 22px; height: 22px; flex: none; }
.cqc-launch:focus-visible, .cqc button:focus-visible, .cqc a:focus-visible, .cqc textarea:focus-visible, .cqc input:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }
.cqc-launch:focus-visible { outline-color: var(--text); }

.cqc-panel { position: fixed; z-index: 41; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: min(380px, calc(100vw - 32px)); height: min(600px, calc(100vh - 110px)); height: min(600px, calc(100dvh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow), 0 24px 60px -20px rgba(0,0,0,.35); }
.cqc-panel[hidden] { display: none; }

.cqc-head { display: flex; align-items: center; gap: 4px; padding: 12px 10px 12px 16px; background: var(--band); color: var(--band-fg); }
.cqc-id { flex: 1; min-width: 0; }
.cqc-head h2 { margin: 0; font: 700 1.02rem/1.2 var(--f-display); letter-spacing: -.01em; color: var(--band-fg); }
.cqc-head p { margin: 2px 0 0; font-size: .82rem; color: var(--band-muted); }
.cqc-icon { flex: none; width: 40px; height: 40px; display: grid; place-content: center; border: 0; border-radius: 10px; background: transparent; color: var(--band-fg); cursor: pointer; }
.cqc-icon:hover { background: rgba(255,255,255,.1); }
.cqc-icon svg { width: 20px; height: 20px; }
.cqc-head .cqc-icon:focus-visible { outline-color: var(--band-accent); outline-offset: -3px; }

.cqc-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; background: var(--paper); }
.cqc-log { display: flex; flex-direction: column; gap: 10px; }
.cqc-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: .96rem; line-height: 1.45; overflow-wrap: anywhere; }
.cqc-msg p { margin: 0; }
.cqc-msg p + p { margin-top: 6px; }
.cqc-a { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.cqc-u { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.cqc-u p { white-space: pre-wrap; }
.cqc-warn { border-color: var(--warn); background: var(--warn-soft); }
.cqc-msg a { color: var(--accent); font-weight: 600; }
.cqc-action { display: inline-flex; margin-top: 8px; padding: 8px 12px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink) !important; text-decoration: none; font: 700 .9rem/1.2 var(--f-display); }
.cqc-action:hover { background: var(--accent-hover); }

.cqc-typing { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; }
.cqc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; }

.cqc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cqc-chips[hidden] { display: none; }
.cqc-chip { border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 99px; padding: 7px 12px; font: 600 .88rem/1.2 var(--f-body); cursor: pointer; }
.cqc-chip:hover { background: var(--accent-soft); }

.cqc-human { display: grid; gap: 4px; margin: 12px 0 6px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.cqc-human[hidden] { display: none; }
.cqc-htitle { margin: 0 0 4px; font: 700 .95rem/1.3 var(--f-display); }
.cqc-human label { font-size: .85rem; font-weight: 600; margin-top: 4px; }
.cqc-human input, .cqc-human textarea, .cqc-compose textarea {
  width: 100%; box-sizing: border-box; font: 400 1rem/1.4 var(--f-body); padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--field-bg); color: var(--field-fg); }
.cqc-human textarea { resize: vertical; min-height: 64px; }
.cqc-human input::placeholder, .cqc-compose textarea::placeholder { color: var(--field-ph); }
.cqc-note { margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.cqc-err { margin: 0; font-size: .85rem; color: var(--fail); }
.cqc-err:empty { display: none; }
.cqc-hactions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.cqc-hsend { padding: 10px 14px; font-size: .92rem; }
.cqc-hsend:disabled { opacity: .6; cursor: wait; }
.cqc-link { border: 0; background: none; padding: 4px; color: var(--muted); font: 600 .9rem var(--f-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.cqc-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px; border-top: 1px solid var(--line); background: var(--surface); }
.cqc-compose textarea { flex: 1; min-width: 0; resize: none; max-height: 132px; }
.cqc-send { flex: none; width: 44px; height: 44px; display: grid; place-content: center; border: 0; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.cqc-send:hover { background: var(--accent-hover); }
.cqc-send:disabled { opacity: .55; cursor: wait; }
.cqc-send svg { width: 20px; height: 20px; }
.cqc-foot { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 0 12px 8px; background: var(--surface); font-size: .74rem; color: var(--muted); }
.cqc-count { font-variant-numeric: tabular-nums; }

/* Téléphone : panneau pleine largeur ; le bouton se cache pendant l'ouverture. */
@media (max-width: 520px) {
  .cqc-panel { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto;
    height: calc(100vh - 16px); height: calc(100dvh - 16px - env(safe-area-inset-bottom, 0px)); max-height: 680px; }
  .cqc-is-open .cqc-launch { display: none; }
  .cqc-launch { height: 46px; padding: 0 14px 0 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .cqc-launch { transition: transform .15s ease, background .15s ease; }
  .cqc-launch:hover { transform: translateY(-2px); }
  .cqc-panel:not([hidden]) { animation: cqc-in .18s ease-out; }
  .cqc-dot { animation: cqc-blink 1.2s infinite ease-in-out; }
  .cqc-dot:nth-child(3) { animation-delay: .15s; }
  .cqc-dot:nth-child(4) { animation-delay: .3s; }
}
@keyframes cqc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cqc-blink { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }

@media print { .cqc { display: none; } }
