.chat-dialog-inner { display: grid; gap: .85rem; min-width: 0; }
.chat-dialog-inner h2,.chat-dialog-inner p { margin: 0; }
.chat-dialog-inner textarea { display: block; box-sizing: border-box; width: 100%; resize: vertical; font: inherit; }
.chat-consent-dialog { box-sizing: border-box; max-width: min(40rem,calc(100vw - 2rem)); max-height: 85dvh; overflow: auto; }
.chat-consent-choice { display: flex; align-items: baseline; gap: .5rem; }
.chat-dialog-inner details,.chat-source,.chat-bubble { overflow-wrap: anywhere; }
.chat-dialog-inner summary,.chat-source summary { cursor: pointer; }
.chat-dialog-inner .chat-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.chat-bubble .chat-text,.chat-source blockquote,.chat-context-message { white-space: pre-wrap; }
.chat-source blockquote { margin: .5em 0; border-inline-start: 2px solid currentColor; padding-inline-start: .75em; }
.chat-citation-link { border: 0; background: transparent; padding: 0 .16em; font: inherit; color: var(--accent,#205e4f); text-decoration: underline; }
.chat-thread { width: min(100%,48rem); margin: 0 auto; padding: .5rem .15rem 1.5rem; }
.chat-message-row { display: flex; margin: 1.25rem 0; line-height: 1.7; }
.chat-user { justify-content: flex-end; }
.chat-user .chat-bubble { max-width: 90%; padding: .65rem 1rem; border-radius: 1.15rem 1.15rem .35rem 1.15rem; background: #d9eadf; }
.chat-assistant .chat-bubble { flex: 1; min-width: 0; padding: .85rem 1rem; border-radius: .35rem 1.15rem 1.15rem; background: var(--glass-card,#fff); }
.chat-bubble small { display: inline-block; color: var(--muted,#566b61); font-size: .76rem; }
.chat-bubble > small { margin: .5rem .65rem 0 0; }
.chat-sources { display: grid; gap: .3rem; margin-top: .65rem; }
.chat-source { padding: .35rem .65rem; border: 1px solid var(--line,#ccd8d0); border-radius: .6rem; }
.chat-source summary { font-size: .85rem; }
.chat-source a { font-weight: 600; }
.chat-dialog-inner textarea { border: 1px solid var(--line,#ccd8d0); border-radius: .65rem; padding: .65rem; background: #fffc; }
.chat-dialog-inner button { padding: .35rem .7rem; border: 1px solid var(--line,#ccd8d0); border-radius: .6rem; background: #fffa; color: var(--ink,#203630); }
.chat-dialog-inner #chat-confirm-send { background: var(--accent,#205e4f); color: #fff; }
.chat-dialog-inner button:disabled { opacity: .5; cursor: default; }
.chat-consent-dialog { width: min(40rem,calc(100vw - 2rem)); padding: clamp(1rem,3vw,1.65rem); }
.chat-attribution { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 650; color: var(--muted,#566b61); }
#chat-thread .chat-assistant .chat-bubble:has(.chat-attribution)::before { content: none; }
.chat-case-links[hidden] { display: none; }
#chat-offline { flex-basis: 100%; margin: 0; }
#chat-privacy-hint { margin: 0 0 .5rem; color: var(--muted,#566b61); font-size: .8rem; }
#chat-app:not(.chat-input-ready) #chat-compose { display: none; }
.chat-case-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .65rem; }
#chat-review-actions { width: min(100%,48rem); margin: 0 auto .65rem; }
#chat-review-refresh { font: inherit; padding: .4rem .8rem; border-radius: .65rem; border: 1px solid var(--line,#ccd8d0); background: var(--glass-card,#fff); }

.chat-answer-section + .chat-answer-section { margin-top: 1.05rem; }
.chat-answer-section h3 { margin: 0 0 .3rem; font-size: 1em; line-height: 1.45; }
.chat-answer-section p { margin: 0; }
.chat-answer-section p + p { margin-top: .45rem; }
.chat-section-status { margin-bottom: .28rem; }
.chat-citation-link { min-width: 1.6rem; min-height: 1.5rem; margin-inline: .1rem; border-radius: .4rem; background: #e6f1e7; line-height: 1.25; text-decoration: none; vertical-align: baseline; }
.chat-citation-link:is(:hover,:focus-visible) { background: #cee4d2; }
.chat-citation-link:focus-visible,.chat-source summary:focus-visible { outline: 2px solid #286d4c; outline-offset: 2px; }
.chat-citation-preview { position: fixed; z-index: 80; box-sizing: border-box; width: 26rem; overflow: auto; overscroll-behavior: contain; border: 1px solid #afc9b5; border-radius: .8rem; padding: .85rem 1rem; background: #fcfdf8; color: #243d2d; box-shadow: 0 8px 28px #263d2e33; overflow-wrap: anywhere; }
.chat-citation-preview strong,.chat-citation-preview small { display: block; }
.chat-citation-preview small { color: #486352; margin-top: .25rem; }
.chat-citation-preview blockquote { white-space: pre-wrap; margin: .65rem 0 0; border-inline-start: 2px solid #85ac8f; padding-inline-start: .7rem; line-height: 1.65; }
@media (max-width:760px),(pointer:coarse) {
  .chat-citation-link { min-width: 2.15rem; min-height: 1.85rem; }
  .chat-citation-link::after { content: "↓"; padding-inline-start: .12em; }
}
.chat-issue-report { margin-top: .65rem; font-size: .88rem; }
.chat-issue-report summary { cursor: pointer; color: #405a48; }
.chat-issue-report select, .chat-issue-report button { max-width: 100%; margin: .35rem .35rem 0 0; min-height: 2.5rem; }
.chat-issue-report [role="status"] { display: block; }
