/* Rayan AI Connector 0.20.19 — RAG-MODES + CONNECTOR-UX contractuel. */
#rayan-ai-root .rai-history-limit-notice {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid rgba(31, 255, 111, .42);
  border-radius: 10px;
  background: rgba(3, 34, 17, .76);
  color: #caffd8;
  font-family: inherit;
  line-height: 1.45;
}

/* RAG-Q0.6 — séparation visuelle entre corpus RAG et modèle seul. */
.rai-knowledge-mode-notice {
  display: grid;
  gap: 0.3rem;
  width: min(100%, 760px);
  margin: 0 0 0.55rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(250, 204, 21, 0.72);
  border-radius: 12px;
  background: rgba(69, 50, 4, 0.34);
  color: #fef3c7;
  box-shadow: inset 0 0 18px rgba(250, 204, 21, 0.05);
}

.rai-knowledge-mode-notice strong {
  color: #fde047;
  font-size: 0.78rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.rai-knowledge-mode-notice span {
  color: #fef9c3;
  font-size: 0.78rem;
  line-height: 1.45;
}

.rayan-ai-message-row.is-model-only .rayan-ai-bubble {
  border-color: rgba(250, 204, 21, 0.62);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.06);
}

.rai-model-fallback-offer {
  display: grid;
  gap: 0.65rem;
  width: min(100%, 760px);
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid rgba(40, 255, 107, 0.42);
  border-radius: 12px;
  background: rgba(0, 36, 17, 0.76);
}

.rai-model-fallback-offer > span {
  color: rgba(218, 255, 229, 0.8);
  font-size: 0.78rem;
  line-height: 1.45;
}

.rai-model-fallback-button {
  justify-self: start;
  min-height: 38px;
  padding: 0.55rem 0.8rem;
  border: 1px solid #35ff75;
  border-radius: 8px;
  background: rgba(0, 92, 38, 0.5);
  color: #effff4;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.rai-model-fallback-button:hover,
.rai-model-fallback-button:focus-visible {
  background: #16a34a;
  color: #fff;
  outline: none;
  box-shadow: 0 0 16px rgba(53, 255, 117, 0.25);
}

.rai-model-fallback-button:disabled {
  cursor: default;
  opacity: 0.72;
}

@media (max-width: 680px) {
  .rai-model-fallback-button {
    width: 100%;
  }
}

#rayan-ai-root .rai-history-limit-notice strong {
  color: #55ff8d;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

#rayan-ai-root .rai-history-limit-notice span {
  font-size: 11px;
}

/* Sans contrat Core actif pour Persona/Périmètre, la barre ne conserve que
   les outils réellement utilisables et reste centrée sur toutes les tailles. */
#rayan-ai-root #rayan-ai-modal .rai-composer-dock.rai-basic-tools .rai-chat-tools {
  grid-template-columns: 1fr !important;
}

#rayan-ai-root #rayan-ai-modal .rai-composer-dock.rai-basic-tools .rai-chat-tools-left {
  width: 100% !important;
  justify-content: center !important;
}

/* Sélecteur initial : Élu et Gardien uniquement, verrouillé après le premier message. */
#rayan-ai-root .rai-response-mode-selector {
  grid-column: 1 / -1;
  width: min(100%, 980px);
  margin: 0.35rem auto 0;
  padding: 0.65rem;
  border: 1px solid rgba(53, 255, 117, 0.34);
  border-radius: 12px;
  background: rgba(0, 22, 10, 0.72);
}

#rayan-ai-root .rai-response-mode-selector[hidden] {
  display: none !important;
}

#rayan-ai-root .rai-response-mode-selector legend {
  padding: 0 0.45rem;
  color: rgba(211, 255, 224, 0.78);
  font-size: 0.7rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

#rayan-ai-root .rai-response-mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

#rayan-ai-root .rai-response-mode-button {
  display: grid;
  gap: 0.28rem;
  min-height: 70px;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(125, 255, 163, 0.32);
  border-radius: 9px;
  background: rgba(0, 34, 15, 0.76);
  color: #eaffef;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#rayan-ai-root .rai-response-mode-button strong {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#rayan-ai-root .rai-response-mode-button span {
  color: rgba(222, 255, 232, 0.72);
  font-size: 0.67rem;
  line-height: 1.4;
}

#rayan-ai-root .rai-response-mode-button.is-green.is-active {
  border-color: #35ff75;
  background: rgba(0, 91, 37, 0.58);
  box-shadow: 0 0 17px rgba(53, 255, 117, 0.2), inset 0 0 14px rgba(53, 255, 117, 0.06);
}

#rayan-ai-root .rai-response-mode-button.is-yellow.is-active {
  border-color: #facc15;
  background: rgba(80, 57, 0, 0.62);
  box-shadow: 0 0 17px rgba(250, 204, 21, 0.22), inset 0 0 14px rgba(250, 204, 21, 0.06);
}

#rayan-ai-root .rai-response-mode-button.is-red.is-active {
  border-color: #ff405d;
  background: rgba(80, 0, 18, 0.62);
  box-shadow: 0 0 17px rgba(255, 64, 93, 0.23), inset 0 0 14px rgba(255, 64, 93, 0.07);
}

/* Provenance visuelle de chaque réponse. */
#rayan-ai-root .rai-knowledge-mode-notice {
  border-color: rgba(125, 255, 163, 0.5);
  background: rgba(0, 45, 19, 0.62);
  color: #dcffe7;
}

#rayan-ai-root .rai-knowledge-mode-notice strong,
#rayan-ai-root .rai-knowledge-mode-notice span {
  color: inherit;
}

#rayan-ai-root .rai-knowledge-mode-notice.is-green {
  border-color: rgba(53, 255, 117, 0.72);
  background: rgba(0, 59, 24, 0.58);
  color: #dfffe9;
}

#rayan-ai-root .rai-knowledge-mode-notice.is-yellow {
  border-color: rgba(250, 204, 21, 0.78);
  background: rgba(77, 55, 0, 0.58);
  color: #fff3ad;
}

#rayan-ai-root .rai-knowledge-mode-notice.is-red {
  border-color: rgba(255, 64, 93, 0.82);
  background: rgba(75, 0, 17, 0.62);
  color: #ffd9df;
}

#rayan-ai-root .rai-knowledge-mode-notice.is-neutral {
  border-color: rgba(166, 180, 171, 0.52);
  background: rgba(34, 41, 36, 0.62);
  color: #e1e8e3;
}

#rayan-ai-root .rayan-ai-message-row.is-mode-green .rayan-ai-bubble {
  border-color: rgba(53, 255, 117, 0.62);
  box-shadow: 0 0 20px rgba(53, 255, 117, 0.07);
}

#rayan-ai-root .rayan-ai-message-row.is-mode-yellow .rayan-ai-bubble {
  border-color: rgba(250, 204, 21, 0.72);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.08);
}

#rayan-ai-root .rayan-ai-message-row.is-mode-red .rayan-ai-bubble {
  border-color: rgba(255, 64, 93, 0.76);
  box-shadow: 0 0 20px rgba(255, 64, 93, 0.09);
}

#rayan-ai-root .rai-model-provenance-card {
  display: grid;
  gap: 0.35rem;
  margin: 0.7rem 0 0;
  padding: 0.75rem;
  border: 1px solid rgba(250, 204, 21, 0.66);
  border-radius: 9px;
  background: rgba(66, 48, 0, 0.48);
  color: #fff5bd;
}

#rayan-ai-root .rai-model-provenance-badge {
  justify-self: start;
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(250, 204, 21, 0.72);
  border-radius: 999px;
  color: #fde047;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

#rayan-ai-root .rai-model-provenance-card p {
  margin: 0;
  color: #fef3c7;
  font-size: 0.72rem;
  line-height: 1.5;
}

#rayan-ai-root .rai-model-provenance-card small {
  color: rgba(254, 243, 199, 0.68);
  font-size: 0.64rem;
}

@media (max-width: 760px) {
  #rayan-ai-root .rai-response-mode-options {
    grid-template-columns: 1fr;
  }

  #rayan-ai-root .rai-response-mode-button {
    min-height: 0;
  }
}
