/* Capsule answer body and advice stream client — «Опоры в тексте».
   Brief: .impeccable/surfaces/answer-stream.md. Tokens only from palette.css / design.css.
   Scoped to #assistant-body (owned by answer.js); the capsule state rule is the one exception. */

/* Capsule: amber dot when the answer has no sources. */
.assistant-capsule[data-state=caution] .capsule-indicator{background:var(--warning-300)}

/* Stage line — the single polite status node. */
#assistant-body .as-status{display:flex;align-items:center;gap:8px;margin:0 0 16px;min-height:22px;font-size:12px;line-height:1.5;color:var(--plum-200);font-variant-numeric:tabular-nums}
#assistant-body .as-status.is-empty{min-height:0;margin:0}
#assistant-body .as-status.is-caution{color:var(--warning-300)}
#assistant-body .as-status-lead{display:inline-flex;align-items:center;gap:4px}
#assistant-body .as-status-lead:empty{display:none}
#assistant-body .as-dots{display:inline-flex;gap:4px;margin-right:2px}
#assistant-body .as-dots i{width:5px;height:5px;border-radius:50%;background:var(--mint);animation:request-dots 1.4s ease-in-out infinite}
#assistant-body .as-dots i:nth-child(2){animation-delay:.16s}
#assistant-body .as-dots i:nth-child(3){animation-delay:.32s}
#assistant-body .as-num{display:inline-grid;place-items:center;flex-shrink:0;min-width:20px;height:20px;padding:0 5px;border-radius:10px;font-size:11px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;color:var(--plum-950);background:var(--mint)}
#assistant-body .as-num.is-ghost{min-width:18px;height:18px;padding:0 4px;background:transparent;color:var(--plum-200);box-shadow:inset 0 0 0 1px oklch(from var(--white) l c h / .24)}
#assistant-body .as-status-lead .as-num.is-ghost:last-child{margin-right:4px}

/* Reply — the reading lead. Provisional text is plum-200 (5.65:1 on the glass); final is plum-50. */
#assistant-body .as-reply{margin:0;font-size:16px;font-weight:400;line-height:1.7;letter-spacing:-.01em;color:var(--plum-50);overflow-wrap:anywhere}
#assistant-body .as-reply :is(p,li){font-size:inherit;line-height:inherit;color:inherit}
#assistant-body .as-reply p{margin:0 0 12px}
#assistant-body .as-reply p:last-child{margin-bottom:0}
#assistant-body .as-reply.is-provisional{min-height:calc(4 * 1.7em);color:var(--plum-200)}
#assistant-body .as-reply.is-partial{color:var(--plum-200)}
#assistant-body .as-reply.is-provisional.has-text>p:last-child::after,
#assistant-body .as-reply.is-provisional.has-text>:is(ul,ol):last-child>li:last-child::after{content:'';display:inline-block;width:2px;height:1.05em;margin-left:3px;vertical-align:-.16em;border-radius:1px;background:var(--mint);animation:as-caret 1.05s steps(1) infinite}
@keyframes as-caret{50%{opacity:0}}
#assistant-body .as-skeleton{display:grid;gap:15px;padding-top:8px}
#assistant-body .as-skeleton i{display:block;height:11px;border-radius:6px;background:oklch(from var(--white) l c h / .08);animation:as-breathe 1.8s ease-in-out infinite}
#assistant-body .as-skeleton i:nth-child(2){width:92%;animation-delay:.15s}
#assistant-body .as-skeleton i:nth-child(3){width:97%;animation-delay:.3s}
#assistant-body .as-skeleton i:nth-child(4){width:58%;animation-delay:.45s}
@keyframes as-breathe{50%{background:oklch(from var(--white) l c h / .13)}}
/* A very quick (cached) answer never flashes the skeleton. */
#assistant-body .as-reply.is-provisional .as-skeleton{animation:as-appear 1ms 180ms both}
@keyframes as-appear{from{opacity:0}}

/* Citation chips: a quiet mint numeral with a ≥44px invisible hit area. */
#assistant-body .as-chip{position:relative;display:inline-grid;place-items:center;min-width:17px;height:17px;margin:0 1px 0 3px;padding:0 4px;border:0;border-radius:9px;background:transparent;box-shadow:inset 0 0 0 1px oklch(from var(--mint-400) l c h / .55);color:var(--mint);font:600 11px/1 'Golos Text',sans-serif;font-variant-numeric:tabular-nums;vertical-align:.5em;cursor:pointer;transition:background-color 160ms,color 160ms}
#assistant-body .as-anchor{white-space:nowrap}
#assistant-body .as-chip::before{content:'';position:absolute;inset:-14px -7px}
#assistant-body .as-chip:hover,#assistant-body .as-chip.is-on{background:var(--mint);color:var(--plum-950);box-shadow:none}
#assistant-body .as-chip:focus-visible{outline:2px solid var(--mint);outline-offset:2px}
#assistant-body .as-uns{text-decoration:underline dotted 2px var(--warning-300);text-underline-offset:5px;text-decoration-skip-ink:none}
#assistant-body .as-unv{text-decoration:underline dotted 2px var(--warning-300);text-underline-offset:5px;text-decoration-skip-ink:none}
#assistant-body .as-unv-note{display:inline-flex;align-items:baseline;gap:4px;margin:0 2px 0 6px;font-size:12px;font-weight:500;letter-spacing:0;line-height:1.4;color:var(--warning-300)}
#assistant-body .as-unv-note svg{align-self:center;flex-shrink:0}

/* Notes above the button */
#assistant-body .as-caution{display:flex;gap:9px;align-items:flex-start;margin:20px 0 0;font-size:12px;line-height:1.6;color:var(--warning-300)}
#assistant-body .as-caution svg{flex-shrink:0;margin-top:2px}
#assistant-body .as-late{margin:14px 0 0;font-size:12px;line-height:1.6;color:var(--plum-200);max-width:34ch}
#assistant-body .as-error{padding:0}
#assistant-body .as-slot-notes .as-error{margin-top:20px}
#assistant-body .as-slot-notes .copilot-knowledge{margin-top:16px}
#assistant-body .as-slot-main .copilot-knowledge:first-child{border-top:0;padding-top:0}

/* The one action, in its final place from the start */
#assistant-body .as-action{margin:22px 0 20px}
#assistant-body .as-slot-action:first-child .as-action,#assistant-body .as-slot-main[hidden]+.as-slot-notes[hidden]+.as-slot-action .as-action{margin-top:4px}
#assistant-body .as-action .btn{width:100%;justify-content:center;transition:background-color 160ms,opacity 160ms,transform 220ms cubic-bezier(.2,1.3,.3,1)}
#assistant-body .as-action .btn:active:not(:disabled,[aria-disabled=true]){transform:scale(.97);transition-duration:80ms}
#assistant-body .btn[aria-disabled=true]{opacity:.55;cursor:not-allowed}

/* Numbered legend: rows and drawers are seams inside the card, not nested cards. */
#assistant-body .as-legend{border-top:1px solid var(--assistant-divider);padding-top:12px;margin-bottom:6px}
#assistant-body .as-legend-title{margin:0 0 2px;font-size:12px;font-weight:500;line-height:1.5;letter-spacing:0;color:var(--plum-200)}
#assistant-body .as-sources{list-style:none;margin:0;padding:0}
#assistant-body .as-source+.as-source{border-top:1px solid var(--assistant-divider)}
#assistant-body .as-source-row{display:flex;align-items:flex-start;gap:12px;width:100%;min-height:44px;padding:11px 0;border:0;border-radius:8px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
#assistant-body .as-source-row .as-num{margin-top:1px}
#assistant-body .as-source-row:hover .as-src-name{color:var(--white)}
#assistant-body .as-src-text{flex:1;min-width:0}
#assistant-body .as-src-name{display:block;font-size:13px;font-weight:500;line-height:1.45;color:var(--plum-50);overflow-wrap:anywhere}
#assistant-body .as-src-kind{display:block;margin-top:1px;font-size:12px;line-height:1.5;color:var(--plum-200)}
#assistant-body .as-src-flag{color:var(--warning-300)}
#assistant-body .as-chevron{flex-shrink:0;margin-top:3px;color:var(--plum-200);transition:transform 200ms var(--ease)}
#assistant-body .as-source.is-open .as-chevron{transform:rotate(180deg)}
#assistant-body .as-drawer{padding:0 0 16px 32px}
#assistant-body .as-strip{max-width:100%;max-height:184px;overflow:auto;margin:0 0 12px;border-radius:8px;background:var(--white);box-shadow:inset 0 0 0 1px oklch(from var(--white) l c h / .2);scrollbar-color:var(--plum-400) transparent;overscroll-behavior-x:contain}
#assistant-body .as-strip[hidden]{display:none}
#assistant-body .as-strip img{display:block;max-width:none;height:auto}
#assistant-body .as-strip:focus-visible{outline:2px solid var(--mint);outline-offset:2px}
#assistant-body .as-quote{margin:0;font-size:12px;line-height:1.75;color:var(--plum-150);white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:7;-webkit-box-orient:vertical;overflow:hidden}
#assistant-body .as-quote.is-full{display:block}
#assistant-body .as-quote.has-table{display:block;white-space:normal;overflow-x:auto;max-height:none}
#assistant-body .as-quote.has-table::before,#assistant-body .as-quote.has-table::after{content:none}
#assistant-body .as-quote.has-table .q-text{display:block;white-space:pre-wrap}
#assistant-body .as-quote .q-table{display:table;border-collapse:collapse;font-variant-numeric:tabular-nums}
#assistant-body .as-quote .q-row{display:table-row}
#assistant-body .as-quote .q-cell{display:table-cell;padding:3px 12px 3px 0;border-bottom:1px solid var(--assistant-divider);vertical-align:top;white-space:nowrap}
#assistant-body .as-quote .q-cell.is-hit{color:var(--plum-50);font-weight:500}
#assistant-body .as-quote .pv-num{text-decoration:underline 2px var(--mint-400);text-underline-offset:4px;text-decoration-skip-ink:none;white-space:nowrap}
#assistant-body .as-section{margin:0 0 6px;font-size:12px;line-height:1.5;color:var(--plum-200)}
#assistant-body .as-quote::before{content:'«'}#assistant-body .as-quote::after{content:'»'}
#assistant-body :is(.as-more,.as-open,.as-link){display:inline-flex;align-items:center;gap:7px;min-height:40px;margin:4px 0 0 -8px;padding:6px 8px;border:0;border-radius:9px;background:transparent;color:var(--plum-150);font:500 12px/1.4 'Golos Text',sans-serif;cursor:pointer;transition:background-color 160ms,color 160ms}
#assistant-body :is(.as-more,.as-open,.as-link):hover{background:oklch(from var(--white) l c h / .06);color:var(--white)}
#assistant-body .as-more{display:flex;color:var(--plum-200)}
#assistant-body .as-open svg{color:var(--mint)}
#assistant-body .as-link{color:var(--warning-300);text-decoration:underline;text-underline-offset:4px}
#assistant-body .as-unv-line{display:flex;gap:8px;align-items:flex-start;margin:12px 0 0;color:var(--warning-300)}
#assistant-body .as-unv-line svg{flex-shrink:0;margin-top:3px}
#assistant-body .as-unv-line p{margin:0;font-size:12px;line-height:1.6;color:var(--warning-300)}
#assistant-body .as-question{margin:0 0 14px;font-size:12px;line-height:1.7;color:var(--plum-200)}
#assistant-body .as-slot-reason+.as-slot-extra .copilot-actions{margin-top:4px}

@media(max-width:650px){#assistant-body .as-reply{font-size:15px}#assistant-body .as-drawer{padding-left:0}}
@media(max-width:430px){#assistant-body .as-status-lead .as-num:nth-child(n+4){display:none}}
@media(prefers-reduced-motion:reduce){
 #assistant-body .as-dots{display:none}
 #assistant-body .as-skeleton i{animation:none}
 #assistant-body .as-reply.is-provisional.has-text>p:last-child::after,
 #assistant-body .as-reply.is-provisional.has-text>:is(ul,ol):last-child>li:last-child::after{animation:none}
 #assistant-body :is(.as-chip,.as-chevron,.as-action .btn,.as-more,.as-open,.as-link){transition:none}
 #assistant-body .as-action .btn:active{transform:none}
}

/* Internal sources (audience 'internal'): they guided the reply but are never cited to the client,
   so their legend number is not the mint of a citation chip, and a «внутр.» mark names why. */
#assistant-body .as-source.is-internal .as-num{background:transparent;color:var(--plum-150);box-shadow:inset 0 0 0 1px oklch(from var(--white) l c h / .32)}
#assistant-body .as-src-int{display:inline-flex;align-items:center;gap:3px;color:var(--plum-150);font-weight:500;white-space:nowrap}
#assistant-body .as-src-int svg{flex-shrink:0;margin-top:-1px}
#assistant-body .as-int-note{display:flex;gap:8px;align-items:flex-start;margin:0 0 10px;font-size:12px;line-height:1.6;color:var(--plum-150)}
#assistant-body .as-int-note svg{flex-shrink:0;margin-top:3px}
#assistant-body .as-uns.as-int{text-decoration-style:dashed}
#assistant-body .as-caution+.as-caution{margin-top:10px}
