/* Rendu markdown (réponses assistant), blocs de code, raisonnement, actions de message. */
.message__plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.md { overflow-wrap: anywhere; line-height: var(--leading-relaxed); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md .code-block, .md__table { margin: 0 0 var(--space-3); }
.md__h { margin: var(--space-5) 0 var(--space-2); line-height: var(--leading-tight); font-weight: var(--weight-semibold); color: var(--color-text-strong); }
h1.md__h { font-size: var(--text-2xl); } h2.md__h { font-size: var(--text-xl); } h3.md__h { font-size: var(--text-lg); } h4.md__h, h5.md__h, h6.md__h { font-size: var(--text-md); }
.md ul, .md ol { padding-left: var(--space-6); }
.md li { margin: var(--space-1) 0; }
.md li > ul, .md li > ol { margin: var(--space-1) 0 0; }
.md blockquote { padding: 0 var(--space-4); border-left: 3px solid var(--color-border-strong); color: var(--color-text-muted); }
.md hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-5) 0; }
.md a { color: var(--color-link); text-decoration: underline; text-underline-offset: 2px; }
.md__del { text-decoration: line-through; }
.md__code { padding: 0.15em 0.4em; border-radius: var(--radius-xs); background: var(--color-code-inline-bg); font-family: var(--font-mono); font-size: 0.9em; }
.md__table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: var(--text-sm); }
.md th, .md td { padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); text-align: left; }
.md th { background: var(--color-surface-2); font-weight: var(--weight-semibold); }

.code-block { border-radius: var(--radius-md); background: var(--color-code-bg); color: var(--color-code-text); overflow: hidden; }
.code-block__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4); background: var(--color-code-header-bg); font-size: var(--text-xs); color: var(--syntax-comment); }
.code-block__pre { margin: 0; padding: var(--space-4); overflow-x: auto; font-family: var(--font-mono); font-size: var(--text-sm); line-height: var(--leading-normal); }
.code-block__pre code { font-family: inherit; white-space: pre; }
.tok--keyword { color: var(--syntax-keyword); } .tok--string { color: var(--syntax-string); }
.tok--comment { color: var(--syntax-comment); font-style: italic; } .tok--number { color: var(--syntax-number); }
.tok--type { color: var(--syntax-type); }

.icon-btn { min-height: 32px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-text-muted); cursor: pointer; font-size: var(--text-xs); }
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.icon-btn.is-done { color: var(--color-success); }
.code-block__copy { color: inherit; }

/* Actions de message : discrètes, visibles au survol ET au focus clavier (et toujours sur tactile). */
.message { flex-direction: column; }
.message--user { align-items: flex-end; }
.message__actions { display: flex; gap: var(--space-1); margin-top: var(--space-1); opacity: 0; transition: opacity var(--duration-fast) var(--ease-standard); }
.message:hover .message__actions, .message:focus-within .message__actions { opacity: 1; }
@media (hover: none) { .message__actions { opacity: 1; } }

.reasoning { max-width: 100%; margin-bottom: var(--space-3); border-left: 2px solid var(--color-border-strong); padding-left: var(--space-3); color: var(--color-text-muted); font-size: var(--text-sm); }
.reasoning__toggle { cursor: pointer; padding: var(--space-1) 0; font-weight: var(--weight-medium); }
.reasoning__body { white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--space-2) 0; line-height: var(--leading-relaxed); }

.message-editor { width: min(100%, 560px); display: flex; flex-direction: column; gap: var(--space-2); }
.message-editor__input { width: 100%; box-sizing: border-box; min-height: 72px; resize: vertical; padding: var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface-raised); line-height: var(--leading-normal); }
.message-editor__actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.btn { min-height: 36px; padding: 0 var(--space-4); border: 1px solid transparent; border-radius: var(--radius-full); cursor: pointer; font-weight: var(--weight-medium); }
.btn--ghost { background: none; border-color: var(--color-border-strong); }
.btn--primary { background: var(--color-cta); color: var(--color-cta-contrast); }
.btn--primary:hover { background: var(--color-cta-hover); }

/* ---- Beautify (m0-beautify) -------------------------------------------
   QUOI : code blocks become cards (hairline + soft shadow, language label
   with a violet dot, copy button that answers with a pop); "Thought process"
   gets a rotating chevron and its body unfolds; tables get rounded frames;
   headings tighten; buttons share a press scale.
   POURQUOI : answers are documents — code and tables need an edge to read
   as objects, without Sider's flatness turning into heavy boxes.
   COMMENT : the summary's native marker is hidden and replaced by a ::before
   chevron rotated by [open]; reduced motion keeps the end state (base.css). */
.md__h { letter-spacing: -0.015em; }
.code-block { border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.code-block__bar { border-bottom: 1px solid var(--color-border); font-weight: var(--weight-medium); color: var(--color-text-muted); }
.code-block__lang { display: inline-flex; align-items: center; gap: var(--space-2); }
.code-block__lang::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gradient-accent); }
.code-block__copy { transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-spring); }
.code-block__copy:active { transform: scale(0.92); }
.icon-btn.is-done { animation: nx-done-pop var(--duration-base) var(--ease-spring); }
.tok--function { color: var(--syntax-function); }
.md__table { border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.md__table table { width: 100%; border-style: hidden; }
.md blockquote { border-left-color: var(--color-accent); border-left-width: 3px; background: linear-gradient(90deg, var(--color-accent-soft), transparent 60%); padding-block: var(--space-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.reasoning { border-left: 0; padding: var(--space-1) var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); width: fit-content; transition: background var(--duration-base) var(--ease-standard); }
.reasoning[open] { width: auto; }
.reasoning__toggle { list-style: none; display: flex; align-items: center; gap: var(--space-2); }
.reasoning__toggle::-webkit-details-marker { display: none; }
.reasoning__toggle::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--duration-base) var(--ease-standard);
}
.reasoning[open] > .reasoning__toggle::before { transform: rotate(45deg); }
.reasoning__toggle:hover { color: var(--color-text); }
.reasoning[open] .reasoning__body { animation: nx-unfold var(--duration-enter) var(--ease-standard) both; border-top: 1px solid var(--color-border); margin-top: var(--space-1); }

.btn { transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.btn--ghost:hover { background: var(--color-surface-2); }
.btn:active, .icon-btn:active { transform: scale(0.96); }
.message-editor__input { transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }
.message-editor__input:focus { border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
@keyframes nx-done-pop { 50% { transform: scale(1.08); } }
@keyframes nx-unfold { from { opacity: 0; transform: translateY(-4px); } }

/* ---- Icons (m1-design-pass) --------------------------------------------
   QUOI : glyph characters replaced by .nx-icon masks (styles/icons.css). 
   COMMENT : icon + label buttons line up on one axis. */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); }
