/* Chat UI polish - loaded after the critical inline styles. */
.compose {
  overflow: visible;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-elev) 96%, white 4%), var(--bg-elev));
  border-color: color-mix(in srgb, var(--border2) 82%, var(--text3) 18%);
  border-radius: 21px;
  box-shadow: 0 10px 32px rgba(20, 18, 16, .07), 0 1px 2px rgba(20, 18, 16, .04);
}
.compose:focus-within {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border2));
  box-shadow: 0 12px 36px rgba(20, 18, 16, .09), 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.compose-input { padding: 16px 18px 9px; }
#message-input { min-height: 28px; font-size: 15.5px; line-height: 1.55; }
.compose-bar {
  min-height: 48px;
  padding: 7px 9px 9px;
  border-top: 1px solid color-mix(in srgb, var(--border) 58%, transparent);
}
.compose-bar-left, .compose-bar-right { gap: 6px; }
.cbtn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.cbtn:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: none;
}
.cbtn:focus-visible,
.model-select:focus-visible,
.send-btn:focus-visible,
.topbar-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.model-select {
  min-height: 34px;
  gap: 7px;
  padding: 0 10px 0 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20,18,16,.04);
}
.model-select:hover,
.model-select[aria-expanded="true"] {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  color: var(--text);
}
.model-select-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border-radius: 7px;
}
.model-select-icon svg { width: 13px; height: 13px; opacity: 1; }
.model-select > svg { transition: transform .18s ease; }
.model-select[aria-expanded="true"] > svg { transform: rotate(180deg); }
.model-dropdown {
  width: min(320px, calc(100vw - 32px));
  padding: 7px;
  border-radius: 15px;
  box-shadow: 0 18px 55px rgba(20,18,16,.20), 0 2px 8px rgba(20,18,16,.08);
}
.model-dropdown-item { padding: 10px 11px; border: 1px solid transparent; border-radius: 10px; }
.model-dropdown-item:hover { background: var(--surface2); border-color: var(--border); }
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.send-btn svg { width: 16px; height: 16px; }
.input-stats { opacity: .72; }
.compose-hint { margin-top: 9px; opacity: .84; }

.file-preview.has-files { gap: 8px; }
.file-chip {
  min-height: 34px;
  max-width: min(280px, 100%);
  padding: 4px 7px 4px 6px;
  border-radius: 11px;
}
.file-chip.has-preview { padding-left: 4px; }
.file-chip-preview {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface2);
}
.file-chip-icon { display: grid; flex: 0 0 22px; place-items: center; color: var(--accent); }
.file-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .rm {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  margin-left: 2px;
  border-radius: 7px;
  font-size: 11px;
}
.file-chip .rm:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.laumaz-thinking {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 6px 2px;
  color: var(--text2);
}
.thinking-pulse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 32px;
}
.thinking-pulse .think-dot {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
.thinking-copy {
  display: grid;
  min-width: min(420px, 68vw);
  gap: 3px;
  line-height: 1.25;
}
.thinking-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.thinking-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.thinking-copy span {
  color: var(--text3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.thinking-copy .thinking-detail {
  max-width: 480px;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.45;
}
.generation-activity {
  width: min(540px, 100%);
  margin: 0 0 7px;
  color: var(--text2);
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.generation-activity summary {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}
.generation-activity summary::-webkit-details-marker { display: none; }
.generation-activity-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
  animation: thinkPulse 1.4s infinite ease-in-out;
}
.generation-activity:not([open]) .generation-activity-dot { animation: none; opacity: .68; }
.generation-steps { display: grid; gap: 0; margin: 0; padding: 1px 12px 5px 31px; list-style: none; }
.generation-step { position: relative; display: grid; gap: 2px; padding: 7px 6px 7px 11px; border-left: 1px solid var(--border2); opacity: .62; }
.generation-step::before { position: absolute; top: 12px; left: -4px; width: 7px; height: 7px; content: ''; background: var(--text3); border: 2px solid var(--surface); border-radius: 50%; }
.generation-step.is-active { opacity: 1; }
.generation-step.is-active::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.generation-step.is-done::before { background: var(--success); }
.generation-step strong { color: var(--text); font-size: 12px; font-weight: 600; }
.generation-step span { color: var(--text3); font-size: 11px; line-height: 1.4; }
.generation-privacy { margin: 0 12px 10px 31px; color: var(--text3); font-size: 10.5px; line-height: 1.4; }

/* Aperçu peu coûteux pendant le flux. Le Markdown complet remplace ce bloc à
   la fin de la réponse, ce qui évite les gels sur les longues générations. */
.streaming-preview {
  min-height: 1.5em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.topbar-action-btn {
  position: relative;
  width: 34px !important;
  height: 34px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
}
.topbar-action-btn:hover { border-color: var(--border) !important; }
.topbar-action-btn.is-active {
  color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 11%, transparent) !important;
  border-color: color-mix(in srgb, var(--accent) 28%, transparent) !important;
}
.topbar-action-btn.is-active::after {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 5px;
  height: 5px;
  content: '';
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 50%;
}

@media (max-width: 680px) {
  .composer-area { padding-inline: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .compose { border-radius: 17px; }
  .compose-input { padding: 13px 14px 7px; }
  .compose-bar { min-height: 46px; padding: 6px 7px 7px; }
  .model-select { max-width: 158px; }
  #current-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .input-stats { display: none !important; }
  .compose-hint { padding-inline: 12px; line-height: 1.45; }
  .thinking-copy { min-width: min(270px, 70vw); }
  .generation-activity { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .compose, .model-select > svg, .send-btn, .cbtn { transition: none !important; }
  .thinking-pulse .think-dot { animation: none !important; opacity: .7; transform: scale(1); }
  .generation-activity-dot { animation: none !important; }
}
