/* Composer : carte arrondie. Barre d'outils au-dessus, champ, bouton envoyer. */
.composer { flex: none; padding: var(--space-3) var(--space-5) var(--space-5); }
.composer__box { max-width: var(--chat-max-width); margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-2) var(--space-3) var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius-xl); background: var(--color-surface-raised); box-shadow: var(--shadow-sm); transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }
.composer__box:focus-within { border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
.composer__toolbar { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; }
.composer__row { display: flex; align-items: flex-end; gap: var(--space-2); }
.composer__input { flex: 1; min-width: 0; max-height: 40vh; resize: none; border: 0; outline: 0; background: none; padding: var(--space-2) var(--space-1); line-height: var(--leading-normal); field-sizing: content; }
.composer__btn { width: var(--hit-target); height: var(--hit-target); flex: none; border: 0; border-radius: var(--radius-full); background: var(--color-cta); color: var(--color-cta-contrast); cursor: pointer; transition: background var(--duration-fast) var(--ease-standard); }
.composer__btn:hover:not(:disabled) { background: var(--color-cta-hover); }
.composer__btn:disabled { background: var(--color-surface-2); color: var(--color-text-subtle); cursor: not-allowed; }
@media (max-width: 720px) { .composer { padding: var(--space-2) var(--space-3) var(--space-3); } }

/* ---- Beautify (m0-beautify) -------------------------------------------
   QUOI : the composer floats — raised shadow tinted by the accent, a lit top
   edge, a soft fade of the thread behind it; the send button "arms" with a
   spring when there is text, the stop button breathes while streaming.
   POURQUOI : the composer is Sider's signature surface; feedback on send /
   stop tells the user the app heard them before any token arrives.
   COMMENT : arming = transition on transform between :disabled (0.88) and
   enabled (1) with --ease-spring — no JS. The stop pulse is a box-shadow
   ring; reduced motion collapses it to one 1 ms iteration (base.css). */
.composer { position: relative; }
.composer::before { /* thread fades out under the composer instead of being cut */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: var(--space-6);
  background: linear-gradient(to bottom, transparent, var(--color-bg)); pointer-events: none;
}
.composer__box { box-shadow: var(--shadow-raised), var(--shadow-inset-highlight); border-color: var(--color-border); transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.composer__box:hover { border-color: var(--color-border-strong); }
.composer__box:focus-within { border-color: var(--color-accent); box-shadow: var(--shadow-raised), var(--shadow-focus); }
.composer__input::placeholder { transition: opacity var(--duration-base) var(--ease-standard); }
.composer__input:focus::placeholder { opacity: 0.7; }
.composer__btn { display: inline-grid; place-items: center; font-size: var(--text-sm); transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-standard); }
.composer__btn:not(:disabled) { box-shadow: var(--shadow-md); }
.composer__btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-accent); }
.composer__btn:active:not(:disabled) { transform: scale(0.92); transition-duration: var(--duration-fast); }
.composer__btn:disabled { transform: scale(0.88); box-shadow: none; }
.composer__btn--stop { animation: nx-stop-pulse 1.6s var(--ease-standard) infinite; }
@keyframes nx-stop-pulse {
  0%   { box-shadow: 0 0 0 0 light-dark(rgb(12 13 25 / 0.28), rgb(127 96 255 / 0.5)); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
/* The field sits inside a box that already shows focus (accent border + halo):
   a second ring on the textarea itself doubled the cue (seen on the build). */
.composer__input:focus-visible { outline: none; box-shadow: none; }

/* ---- Icons (m1-design-pass) --------------------------------------------
   QUOI : glyph characters replaced by .nx-icon masks (styles/icons.css). 
   POURQUOI : the composer gains Sider's toolbars (mock-up chat.html): tools
   + chips on top, Skills / @ / mic / send at the bottom.
   COMMENT : two .composer__toolbar rows; __sep is a 1px rule, __spacer pushes
   mic + send to the end. Icon tools are 36px squares (48 on touch via
   --hit-target); chips are pills whose pressed state is the accent-soft fill
   (+ aria-pressed, so meaning is not carried by colour alone). */
.composer__toolbar { gap: var(--space-1); min-width: 0; }
.composer__toolbar--top { flex-wrap: wrap; }
.composer__toolbar--bottom { margin-top: var(--space-1); }
.composer__sep { width: 1px; height: 18px; flex: none; margin-inline: var(--space-1); background: var(--color-border-strong); }
.composer__spacer { flex: 1; }
.composer__tool {
  display: inline-grid; place-items: center; width: var(--hit-target); min-height: var(--hit-target); padding: 0;
  border-radius: var(--radius-full); color: var(--color-text-muted);
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.composer__tool:hover { background: var(--color-surface-2); color: var(--color-text); }
.composer__tool:active { transform: scale(0.92); }
.composer__tool.is-active, .composer__tool[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent-soft-text); }
.composer__at { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: 1; }
.toolchip {
  display: inline-flex; align-items: center; gap: var(--space-1); flex: none;
  min-height: 32px; padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-full);
  background: none; color: var(--color-text-muted); cursor: pointer; white-space: nowrap;
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.toolchip:hover { background: var(--color-surface-2); color: var(--color-text); }
.toolchip:active { transform: scale(0.95); }
.toolchip.is-active, .toolchip[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-accent-soft-text); border-color: rgb(from var(--color-accent) r g b / 0.24); }
.kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 var(--space-1); margin-left: var(--space-1);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-xs);
  font-family: var(--font-mono); font-size: 0.6875rem; line-height: 1; color: var(--color-text-subtle);
}
/* send / stop now live in the bottom toolbar: centre the masked icon. */
.composer__btn .nx-icon { margin: auto; }
@media (max-width: 720px) {
  .toolchip { padding: 0 var(--space-2); }
}
@media (pointer: coarse) { .toolchip { min-height: var(--hit-target); } }
/* Narrow: the top row scrolls sideways instead of wrapping a lone chip onto
   a second line (390px capture). */
@media (max-width: 720px) {
  .composer__toolbar--top { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}

/* m5-mobile-menus — the toolbar popovers open INSIDE the viewport on mobile.
   QUOI : at ≤ 720 px the model menu and the image-engine menu are anchored
   on the composer card (full card width, opening above it) instead of on
   their trigger.
   POURQUOI : the top row scrolls sideways (overflow-x: auto, above), and an
   overflow box clips every absolute descendant whose containing block lies
   inside it — the menus opened but were cut off and could not be tapped
   (image-menu started at x=218 on a 390 px screen).
   COMMENT : the trigger wrappers go position: static, so the menus' nearest
   positioned ancestor becomes .composer__box (position: relative, set in
   skill-bar.css), which sits OUTSIDE the scrolling row → no clipping. Then
   inset-inline 0 stretches them to the card: a bottom-sheet-like popover,
   every row a full-width target. The drop-down picker of the compare panes
   (.model-picker--down) keeps its own anchoring. */
@media (max-width: 720px) {
  .composer__toolbar--top :is(.model-picker:not(.model-picker--down), .image-mode) { position: static; }
  .composer__toolbar--top :is(.model-picker:not(.model-picker--down) .model-picker__menu, .image-mode__menu) {
    inset-inline: 0; inline-size: auto; min-width: 0; max-width: none;
    transform-origin: bottom center;
  }
}
