/* Чат */
#view-chat { position: relative; }
#chat-messages { flex: 1; overflow-y: auto; overflow-anchor: none; scrollbar-gutter: stable; padding: 18px max(14px, calc(50% - 380px)); display: flex; flex-direction: column; gap: 18px; }
#chat-messages > * { flex-shrink: 0; }
.chunk > p:first-child { margin-top: 9px; }
.chunk > p:last-child { margin-bottom: 9px; }
/* Новый абзац проявляется, курсор стоит в конце печатаемого. */
.streaming > .chunk:last-child { animation: appear .3s ease-out; }
.streaming > .chunk:last-child > :last-child::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: var(--accent); animation: caret 1s ease-in-out infinite; }
@keyframes appear { from { opacity: .15; } }
@keyframes caret { 50% { opacity: .25; transform: scale(.75); } }
.greeting { margin: auto; text-align: center; }
.greeting h2 { font-weight: 600; font-size: 24px; margin: 0 0 14px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.message.user { align-self: flex-end; max-width: 84%; background: var(--side); border-radius: 18px 18px 4px 18px; padding: 0 16px; }
.message.assistant { max-width: 100%; }
.message .markdown > p { margin: 9px 0; }
.message-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.message-tools .icon-button { width: 28px; height: 28px; }
.message-tools .icon { width: 16px; height: 16px; }
.message-meta { color: var(--muted); font-size: 11px; margin-left: 6px; }
.sources { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 3px 11px; font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }
.chip.active { border-color: var(--accent); }
.typing { display: flex; gap: 5px; padding: 10px 2px; align-items: center; color: var(--muted); font-size: 13px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bounce 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }
#composer { position: relative; margin: 0 max(10px, calc(50% - 390px)) 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 8px 10px 8px; display: flex; flex-direction: column; gap: 4px; }
#composer:focus-within { border-color: var(--accent); }
#chat-input { width: 100%; background: none; border: 0; resize: none; outline: none; padding: 6px 40px 4px 6px; line-height: 1.5; max-height: 220px; font-size: 16px; }
#expand-button { position: absolute; right: 8px; top: 6px; width: 30px; height: 30px; }
#composer.expanded { position: absolute; inset: 56px 0 0; margin: 0 max(10px, calc(50% - 440px)) 10px; z-index: 5; }
#composer.expanded #chat-input { flex: 1; max-height: none; height: auto !important; }
.composer-row { display: flex; align-items: center; gap: 4px; }
#model-select { background: none; border: 1px solid var(--line); border-radius: 16px; padding: 4px 8px; font-size: 13px; max-width: 190px; min-width: 0; text-overflow: ellipsis; }
#model-select option { background: var(--card); }
@keyframes blink { 50% { opacity: .2; } }
