/* Assistant « Pylo » (2026-10-05) — même univers que style.css :
   papier calque, encre marine, orange sécurité. Tout est préfixé .pylo-. */

.pylo-launcher {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--pylo-offset, 0px));
  z-index: 998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--text, #132433);
  color: #fff;
  font: 600 .95rem/1 var(--font, sans-serif);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(19, 36, 51, .28), 0 0 0 2px rgba(216, 87, 28, .0);
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), box-shadow .2s ease, bottom .25s ease, opacity .2s ease;
}
.pylo-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(19, 36, 51, .32), 0 0 0 2px var(--accent, #d8571c); }
.pylo-launcher:focus-visible { outline: 3px solid var(--accent, #d8571c); outline-offset: 3px; }
.pylo-launcher.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }

.pylo-avatar {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent, #d8571c);
  color: #fff;
  position: relative;
}
.pylo-avatar svg { width: 18px; height: 18px; }
.pylo-launcher .pylo-avatar::after {
  content: "";
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #3fbf7f; border: 2px solid var(--text, #132433);
}

.pylo-panel {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--pylo-offset, 0px));
  z-index: 1010;
  width: 390px;
  height: min(640px, calc(100vh - 40px - var(--pylo-offset, 0px)));
  display: flex;
  flex-direction: column;
  background: var(--card, #fbfbf8);
  color: var(--text, #132433);
  border: 1px solid var(--border, #c9d2c4);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(19, 36, 51, .26);
  overflow: hidden;
  font-family: var(--font, sans-serif);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .22s;
}
.pylo-panel.is-open {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.22, 1, .36, 1);
}

.pylo-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--text, #132433);
  color: #fff;
  border-bottom: 2px solid var(--accent, #d8571c);
  /* trame « plan » discrète */
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 16px 16px;
}
.pylo-head .pylo-avatar { width: 38px; height: 38px; }
.pylo-head-text { flex: 1; min-width: 0; }
.pylo-name { font: 700 1.02rem/1.2 var(--font-display, var(--font, sans-serif)); letter-spacing: .01em; }
.pylo-sub { font-size: .76rem; opacity: .78; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.pylo-sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3fbf7f; }
.pylo-icon-btn {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent; color: #fff;
  cursor: pointer; opacity: .8;
  transition: background .15s ease, opacity .15s ease;
}
.pylo-icon-btn:hover { background: rgba(255,255,255,.1); opacity: 1; }
.pylo-icon-btn:focus-visible { outline: 2px solid var(--accent-bright, #ef6b2c); }
.pylo-icon-btn svg { width: 18px; height: 18px; }

.pylo-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background: var(--bg, #eef1ea);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.pylo-msg { display: flex; gap: 8px; margin: 0 0 12px; align-items: flex-end; animation: pylo-in .25s cubic-bezier(.22, 1, .36, 1); }
.pylo-msg .pylo-avatar { width: 26px; height: 26px; }
.pylo-msg .pylo-avatar svg { width: 14px; height: 14px; }
.pylo-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.pylo-bot .pylo-bubble {
  background: var(--card, #fbfbf8);
  border: 1px solid var(--border, #c9d2c4);
  border-bottom-left-radius: 4px;
}
.pylo-user { justify-content: flex-end; }
.pylo-user .pylo-bubble {
  background: var(--text, #132433);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.pylo-bubble p { margin: 0 0 .55em; }
.pylo-bubble p:last-child, .pylo-bubble ul:last-child, .pylo-bubble ol:last-child { margin-bottom: 0; }
.pylo-bubble ul, .pylo-bubble ol { margin: .2em 0 .6em; padding-left: 1.25em; }
.pylo-bubble li { margin: .18em 0; }
.pylo-bubble a { color: var(--accent-2, #b5460f); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pylo-bubble a:hover { color: var(--accent, #d8571c); }
.pylo-bubble code { font-family: var(--mono, monospace); font-size: .85em; background: var(--card-2, #f4f6f0); border: 1px solid var(--border, #c9d2c4); padding: 0 4px; border-radius: 3px; }
.pylo-bubble pre { background: var(--card-2, #f4f6f0); border: 1px solid var(--border, #c9d2c4); border-radius: 6px; padding: 8px 10px; overflow-x: auto; font-size: .8rem; margin: .4em 0 .6em; }
.pylo-bubble pre code { border: 0; padding: 0; background: none; }
.pylo-bubble.is-notice { border-color: var(--accent, #d8571c); background: #fff6f0; }

.pylo-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.pylo-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--line, #8fa3ad); animation: pylo-dot 1.2s infinite ease-in-out; }
.pylo-typing span:nth-child(2) { animation-delay: .15s; }
.pylo-typing span:nth-child(3) { animation-delay: .3s; }

.pylo-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px 34px; }
.pylo-chip {
  border: 1px solid var(--accent, #d8571c);
  background: var(--card, #fbfbf8);
  color: var(--accent-2, #b5460f);
  border-radius: 999px;
  padding: 7px 12px;
  font: 600 .82rem/1.2 var(--font, sans-serif);
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.pylo-chip:hover { background: var(--accent, #d8571c); color: #fff; }
.pylo-chip:focus-visible { outline: 2px solid var(--text, #132433); outline-offset: 2px; }

/* « Envoyer cette conversation à l'équipe » (2026-10-06) */
.pylo-handoff {
  margin: 0 0 14px 34px;
  padding: 12px 13px;
  border: 1px solid var(--accent, #d8571c);
  border-radius: 12px;
  background: var(--card, #fbfbf8);
  animation: pylo-in .25s cubic-bezier(.22, 1, .36, 1);
}
.pylo-handoff-title { font-weight: 700; font-size: .9rem; color: var(--text, #132433); }
.pylo-handoff-text { font-size: .8rem; color: var(--muted, #3b4f5e); line-height: 1.4; margin: 3px 0 9px; }
.pylo-handoff-form { display: flex; gap: 6px; flex-wrap: wrap; }
.pylo-handoff-email {
  flex: 1 1 150px; min-width: 0; height: 38px; padding: 0 10px;
  border: 1px solid var(--border, #c9d2c4); border-radius: 8px; background: #fff;
  color: var(--text, #132433); font: .88rem var(--font, sans-serif);
}
.pylo-handoff-email:focus { outline: none; border-color: var(--accent, #d8571c); box-shadow: 0 0 0 3px rgba(216, 87, 28, .15); }
.pylo-handoff-send {
  flex: none; height: 38px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--accent, #d8571c); color: #fff; font: 600 .85rem var(--font, sans-serif); cursor: pointer;
}
.pylo-handoff-send:hover { background: var(--accent-2, #b5460f); }
.pylo-handoff-send:disabled { opacity: .6; cursor: default; }
.pylo-handoff-send:focus-visible { outline: 2px solid var(--text, #132433); outline-offset: 2px; }
.pylo-handoff-err { font-size: .78rem; color: var(--red, #b3261e); margin-top: 6px; }
.pylo-handoff-err:empty { display: none; }
.pylo-handoff-err a { color: inherit; }

.pylo-foot { border-top: 1px solid var(--border, #c9d2c4); background: var(--card, #fbfbf8); padding: 10px 12px 8px; }
.pylo-form { display: flex; align-items: flex-end; gap: 8px; }
.pylo-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border, #c9d2c4);
  border-radius: 10px;
  background: #fff;
  color: var(--text, #132433);
  font: .93rem/1.4 var(--font, sans-serif);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pylo-input:focus { outline: none; border-color: var(--accent, #d8571c); box-shadow: 0 0 0 3px rgba(216, 87, 28, .15); }
.pylo-input:disabled { background: var(--card-2, #f4f6f0); }
.pylo-send {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: var(--accent, #d8571c);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.pylo-send:hover { background: var(--accent-2, #b5460f); }
.pylo-send:disabled { opacity: .45; cursor: default; }
.pylo-send:focus-visible { outline: 2px solid var(--text, #132433); outline-offset: 2px; }
.pylo-send svg { width: 18px; height: 18px; }
.pylo-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: .7rem; color: var(--muted, #3b4f5e); line-height: 1.35; }
.pylo-meta a { color: inherit; text-decoration: underline; }
.pylo-quota { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pylo-quota.is-empty { color: var(--red, #b3261e); font-weight: 600; }

@keyframes pylo-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pylo-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 560px) {
  .pylo-launcher { right: 14px; bottom: calc(14px + var(--pylo-offset, 0px)); padding: 8px; }
  .pylo-launcher-label { display: none; }
  .pylo-panel { right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .pylo-meta { flex-direction: column; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .pylo-launcher, .pylo-panel, .pylo-msg, .pylo-typing span { transition: none; animation: none; }
}
@media print { .pylo-launcher, .pylo-panel { display: none !important; } }
