.chat-message.generating {
  padding-left: 18px;
  border-color: rgba(47, 143, 229, .55);
  box-shadow: inset 3px 0 var(--blue), 0 0 24px rgba(47, 143, 229, .08);
}

.working-indicator {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.working-indicator strong {
  margin-left: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.working-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: xen-working-pulse 1.2s infinite ease-in-out;
}

.working-dot:nth-child(2) { animation-delay: .15s; }
.working-dot:nth-child(3) { animation-delay: .3s; }

@keyframes xen-working-pulse {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-4px); }
}

.send-button.cancel {
  border-color: #d94f5c;
  background: #b93643;
  box-shadow: 0 0 0 3px rgba(217, 79, 92, .15);
}

.send-button.cancel:hover,
.send-button.cancel:focus-visible { background: #ca4350; }

@media (prefers-reduced-motion: reduce) {
  .working-dot { animation: none; }
  .working-dot { opacity: .7; }
}

.image-import {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--raised);
}
.image-import[hidden] { display: none; }
.image-import > span { flex: 1; color: var(--muted); font-size: 11px; }
.image-import.has-image > span { color: var(--text); font-weight: 650; }
.image-import.unsupported-model > span { color: #e8bd69; }
.image-preview { position: relative; width: 58px; height: 42px; border: 1px solid var(--line); border-radius: 6px; }
.image-preview img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.image-preview button { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; padding: 0; border: 1px solid #666b78; border-radius: 50%; color: #fff; background: #272b35; }
.submitted-image { width: min(420px, 100%); margin: 0 0 12px auto; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.submitted-image img { width: 100%; max-height: 260px; display: block; object-fit: contain; }

.composer-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.composer-tools:has(#sourceButton[hidden], #imageImport[hidden]) { margin-bottom: 10px; }
.composer-tools:has(#sourceButton[hidden]):has(#imageImport[hidden]) { display: none; }
.composer-tools .image-import { width: auto; margin: 0; padding: 0; border: 0; background: transparent; }
.composer-tools .image-import > span { display: none; }
.composer-tools .button { min-height: 34px; height: 34px; padding: 0 12px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.composer-tools #sourceButton { border-color: #2ea5b1; color: var(--text); background: rgba(46, 165, 177, .08); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .12); }
.composer-tools #sourceButton:hover, .composer-tools #sourceButton:focus-visible { border-color: #2ea5b1; background: rgba(46, 165, 177, .17); }
html[data-theme=light] .composer-tools #sourceButton { background: rgba(46, 165, 177, .07); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .1); }
html[data-theme=light] .composer-tools #sourceButton:hover, html[data-theme=light] .composer-tools #sourceButton:focus-visible { background: rgba(46, 165, 177, .14); }
.composer-tools .image-upload-button { width: auto; min-width: 0; gap: 7px; padding: 0 10px; font-weight: 400; border-color: #2ea5b1; color: var(--text); background: rgba(46, 165, 177, .08); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .12); }
.composer-tools .image-upload-button:hover:not(:disabled), .composer-tools .image-upload-button:focus-visible:not(:disabled) { border-color: #2ea5b1; background: rgba(46, 165, 177, .17); }
html[data-theme=light] .composer-tools .image-upload-button { background: rgba(46, 165, 177, .07); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .1); }
html[data-theme=light] .composer-tools .image-upload-button:hover:not(:disabled), html[data-theme=light] .composer-tools .image-upload-button:focus-visible:not(:disabled) { background: rgba(46, 165, 177, .14); }
.composer-tools .image-upload-button:disabled { border-color: var(--line); color: var(--muted); background: transparent; box-shadow: none; cursor: not-allowed; opacity: .65; }
.image-upload-button svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.composer-tools .image-preview { margin-left: 4px; }
.source-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 10px; }
.source-build-result { width: 100%; min-width: 0; }
.source-attachment { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--bg); font-size: 11px; }
.source-attachment.current-source { border-color: rgba(47,143,229,.65); }
.source-attachment.additional-source { border-color: rgba(74,187,151,.55); }
.source-attachment.reference-source { border-color: rgba(196,151,71,.58); }
.source-attachment button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: var(--raised); }
.source-dialog { width: min(820px,calc(100% - 32px)); max-height: min(860px,calc(100vh - 32px)); padding: 0; overflow: auto; }
.source-dialog .dialog-header { position: sticky; top: 0; z-index: 1; padding: 20px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.source-dialog > p, .source-dialog > label, .source-dialog > .source-upload-button { margin-left: 22px; margin-right: 22px; }
.source-status { min-height: 20px; color: #e8bd69; }
.source-status:not(:empty):not(.oversized-conversion-warning) { width: fit-content; max-width: 100%; padding: 8px 12px; border: 1px solid #d99032; border-radius: 7px; background: rgba(217,144,50,.14); color: #ffd08a; font-size: 13px; font-weight: 650; line-height: 1.5; }
html[data-theme=light] .source-status:not(:empty):not(.oversized-conversion-warning) { border-color: #bc741b; background: #fff1db; color: #824500; }
.source-status.source-error:not(:empty) { border-color: #ff6978; background: rgba(255,105,120,.14); color: #ffb5bd; border-left-width: 4px; }
html[data-theme=light] .source-status.source-error:not(:empty) { border-color: #c83245; background: #fff0f2; color: #a31c2e; }
.source-status.oversized-conversion-warning { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid rgba(255,190,79,.45); border-radius: 7px; background: rgba(178,116,22,.12); color: var(--text); line-height: 1.5; }
.source-status.oversized-conversion-warning strong { color: #ffd479; font-size: 14px; }
.source-status.oversized-conversion-warning p { margin: 0; }
.source-status.oversized-conversion-warning a { color: #79c8ff; }
html[data-theme=light] .source-status.oversized-conversion-warning { border-color: #d49a2e; background: #fff4d9; }
html[data-theme=light] .source-status.oversized-conversion-warning strong { color: #7a4b00; }
html[data-theme=light] .source-status.oversized-conversion-warning a { color: #075f9c; }
.source-field { display: grid; gap: 7px; margin-bottom: 16px; color: var(--text); font-size: 12px; font-weight: 700; }
.source-field input, .source-field select { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--bg); }
.source-field textarea { min-height: 300px; resize: vertical; font-family: Consolas,"Courier New",monospace; font-weight: 400; }
.source-upload-button { width: calc(100% - 44px); margin-bottom: 20px; border-color: #2ea5b1; color: var(--text); background: rgba(46, 165, 177, .08); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .12); }
.source-upload-button:hover, .source-upload-button:focus-visible { border-color: #2ea5b1; background: rgba(46, 165, 177, .17); }
html[data-theme=light] .source-upload-button { background: rgba(46, 165, 177, .07); box-shadow: inset 0 0 0 1px rgba(46, 165, 177, .1); }
html[data-theme=light] .source-upload-button:hover, html[data-theme=light] .source-upload-button:focus-visible { background: rgba(46, 165, 177, .14); }
.source-dialog-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--panel); }
