/* Agent Jobsil : bouton (à la place de l'ancien bouton flottant) et fenêtre de discussion. Couleurs du thème. */
.ag-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5.4rem);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 56px;
  padding: .45rem 1.1rem .45rem .45rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, #2563EB, #1E3A8A);
  color: #fff;
  box-shadow: 0 14px 30px -10px rgba(37, 99, 235, .6);
  font: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.ag-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -10px rgba(37, 99, 235, .7); }
.ag-fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.ag-fab-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
.ag-fab-text { display: grid; line-height: 1.15; text-align: left; }
.ag-fab-text strong { font-size: .92rem; font-weight: 800; }
.ag-fab-text small { font-size: .72rem; opacity: .85; }

.ag-panel {
  position: fixed;
  z-index: 70;
  right: 1rem;
  bottom: 1rem;
  width: min(400px, calc(100vw - 2rem));
  max-height: min(640px, calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .35);
  overflow: hidden;
}
.ag-panel[hidden] { display: none; }
.ag-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding: 1rem 1rem .6rem 1.1rem; border-bottom: 1px solid var(--border); }
.ag-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.ag-head p { margin: .15rem 0 0; font-size: .85rem; color: var(--text-secondary); }
.ag-close { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--background); color: var(--text-secondary); cursor: pointer; flex: none; }
.ag-close:hover { color: var(--text-primary); }
.ag-langs { display: flex; gap: .4rem; padding: .6rem 1rem 0; }
.ag-lang { min-height: 36px; padding: 0 .85rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-secondary); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.ag-lang.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.ag-messages { flex: 1; min-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .9rem 1rem; }
.ag-bubble { max-width: 86%; padding: .6rem .85rem; border-radius: 16px; font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; }
.ag-bubble.is-bot { align-self: flex-start; background: var(--background); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.ag-bubble.is-user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.ag-bubble.is-pending { color: var(--text-secondary); }
.ag-results { display: grid; gap: .4rem; }
.ag-result { display: grid; gap: .1rem; padding: .6rem .8rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); text-decoration: none !important; }
.ag-result:hover { border-color: var(--primary); }
.ag-result-title { font-weight: 800; font-size: .92rem; overflow-wrap: anywhere; }
.ag-result-sub { font-size: .8rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.ag-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.ag-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem; border-radius: 12px; background: var(--primary); color: #fff !important; font-weight: 700; font-size: .88rem; text-decoration: none !important; }
.ag-chips { display: flex; gap: .4rem; overflow-x: auto; padding: 0 1rem .6rem; scrollbar-width: none; }
.ag-chips::-webkit-scrollbar { display: none; }
.ag-chip { flex: none; min-height: 36px; padding: 0 .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--background); color: var(--text-primary); font: inherit; font-size: .83rem; font-weight: 600; cursor: pointer; }
.ag-chip:hover { border-color: var(--primary); color: var(--primary); }
.ag-form { display: flex; align-items: center; gap: .4rem; padding: .7rem .8rem; border-top: 1px solid var(--border); }
.ag-form input { flex: 1; min-width: 0; min-height: 46px; padding: 0 .9rem; border-radius: 14px; border: 1.5px solid var(--border); background: var(--background); color: var(--text-primary); font: inherit; font-size: 16px; }
.ag-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring, rgba(37, 99, 235, .18)); }
.ag-mic, .ag-send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; border: 0; cursor: pointer; }
.ag-mic { background: var(--background); color: var(--text-secondary); border: 1.5px solid var(--border); }
.ag-mic[hidden] { display: none; }
.ag-send { background: var(--primary); color: #fff; }
.ag-send:disabled { opacity: .55; cursor: wait; }
.ag-note { margin: 0; padding: 0 1rem .8rem; font-size: .75rem; color: var(--text-secondary); }
.ag-fab:focus-visible, .ag-close:focus-visible, .ag-chip:focus-visible, .ag-lang:focus-visible, .ag-send:focus-visible, .ag-mic:focus-visible { outline: 3px solid var(--primary-ring, rgba(37, 99, 235, .35)); outline-offset: 2px; }

/* Téléphone : la fenêtre prend tout l'écran, au-dessus de la barre du bas. */
@media (max-width: 599px) {
  .ag-panel { inset: 0; width: 100%; max-height: none; border-radius: 0; border: 0; }
  .ag-messages { min-height: 0; }
  .ag-fab-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ag-fab { transition: none; } .ag-fab:hover { transform: none; } }
