/* STC Maroc — assistant. Couleurs de la marque (vert STC) ; thème sombre = classe `dark` sur <html>. */
:root {
  --stc-bg: #f2f6f3; --stc-surface: #ffffff; --stc-border: #d5e3db; --stc-text: #0b2620; --stc-muted: #4d6359;
  --stc-accent: #0a6b47; --stc-accent-hover: #085a3c; --stc-on-accent: #ffffff; --stc-link: #0a6b47;
}
html.dark {
  --stc-bg: #0b2620; --stc-surface: #12332b; --stc-border: #26493f; --stc-text: #eef5f1; --stc-muted: #a9c2b8;
  --stc-accent: #3b9c77; --stc-accent-hover: #55b891; --stc-on-accent: #062a1f; --stc-link: #7fcbac;
}

.stc-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Bouton en bas à GAUCHE : à droite se trouvent le bouton flottant du calculateur de salaire et « Accepter » du bandeau. */
.stc-chat-fab {
  position: fixed; left: 16px; bottom: 16px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px 0 14px;
  background: var(--stc-accent); color: var(--stc-on-accent); border: none; border-radius: 999px;
  font-family: inherit; font-size: .9rem; font-weight: 600; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgb(0 0 0 / .25); -webkit-tap-highlight-color: transparent;
}
.stc-chat-fab:hover { background: var(--stc-accent-hover); }
/* Pendant l'affichage du bandeau cookies (bas de page, pleine largeur), le bouton se masque. */
body:has(#cookie-title) .stc-chat-fab { display: none; }

.stc-chat-panel {
  position: fixed; left: 16px; bottom: 76px; z-index: 55;
  width: 390px; max-width: calc(100vw - 32px); height: min(580px, calc(100dvh - 100px));
  display: flex; flex-direction: column;
  background: var(--stc-surface); color: var(--stc-text);
  border: 1px solid var(--stc-border); border-radius: 16px; box-shadow: 0 12px 40px rgb(0 0 0 / .28); overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
}
.stc-chat-panel[hidden] { display: none; }

.stc-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--stc-bg); border-bottom: 1px solid var(--stc-border); }
.stc-chat-title { display: grid; line-height: 1.25; }
.stc-chat-title strong { font-size: .95rem; }
.stc-chat-title span { font-size: .75rem; color: var(--stc-muted); }
.stc-chat-close { min-width: 36px; min-height: 36px; background: none; border: none; border-radius: 8px; color: var(--stc-text); font-size: 1rem; cursor: pointer; }
.stc-chat-close:hover { background: var(--stc-border); }

.stc-chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.stc-msg { max-width: 92%; padding: 10px 12px; border-radius: 14px; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.stc-msg p { margin: 0; font-size: inherit; color: inherit; }
.stc-msg p + p { margin-top: 6px; }
.stc-msg-bot { align-self: flex-start; background: var(--stc-bg); border: 1px solid var(--stc-border); border-top-left-radius: 4px; }
.stc-msg-user { align-self: flex-end; background: var(--stc-accent); color: var(--stc-on-accent); border-top-right-radius: 4px; }
.stc-msg a { color: var(--stc-link); text-decoration: underline; text-underline-offset: 2px; }

.stc-chips { margin-top: 10px; }
.stc-chips-title { font-size: .72rem !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--stc-muted) !important; margin-bottom: 6px !important; }
.stc-chips-list { display: flex; flex-wrap: wrap; gap: 6px; }
.stc-chip {
  padding: 7px 11px; background: var(--stc-surface); color: var(--stc-link);
  border: 1.5px solid var(--stc-accent); border-radius: 999px;
  font-family: inherit; font-size: .8rem; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer;
}
.stc-chip:hover { background: var(--stc-bg); }

.stc-chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--stc-border); background: var(--stc-surface); }
.stc-chat-input {
  flex: 1; min-width: 0; padding: 10px 12px; font-family: inherit; font-size: 1rem; line-height: 1.3; /* 16 px : pas de zoom auto sur iOS */
  background: var(--stc-bg); color: var(--stc-text); border: 1px solid var(--stc-border); border-radius: 10px;
}
.stc-chat-input:focus { outline: none; border-color: var(--stc-accent); box-shadow: 0 0 0 3px rgb(10 107 71 / .25); }
.stc-chat-send { padding: 0 14px; background: var(--stc-accent); color: var(--stc-on-accent); border: none; border-radius: 10px; font-family: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.stc-chat-send:hover { background: var(--stc-accent-hover); }
.stc-chat-note { margin: 0; padding: 0 14px 10px; font-size: .7rem; line-height: 1.4; color: var(--stc-muted); background: var(--stc-surface); }

.stc-chat-fab:focus-visible, .stc-chat-close:focus-visible, .stc-chip:focus-visible, .stc-chat-send:focus-visible, .stc-msg a:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 2px; }
.stc-chat-fab:focus-visible { outline-color: var(--stc-text); }

@media (max-width: 520px) {
  .stc-chat-panel { left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: min(78dvh, 640px); border-radius: 16px 16px 0 0; }
  body.stc-chat-open .stc-chat-fab { display: none; }
  .stc-chat-fab-label { display: none; }
  .stc-chat-fab { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) { .stc-chat-panel, .stc-chat-fab { transition: none; } }
@media print { .stc-chat-fab, .stc-chat-panel { display: none !important; } }
