.page-actions > .assistant-trigger { --robot-size: 64px; order: -1; width: 44px; position: relative; color: var(--text); }
.assistant-trigger picture { position: absolute; top: var(--space-2); left: 50%; transform: translateX(-50%); width: var(--robot-size); height: var(--robot-size); }
.assistant-trigger img { display: block; width: 100%; height: 100%; object-fit: contain; }
.page-actions > .assistant-trigger:not(:focus-visible) { outline: none; }
.assistant-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Chat scrolls independently; expanded references can scroll on short screens. */
.assistant-dialog { padding: var(--space-4); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); overflow: hidden; box-shadow:0 16px 48px #0005; }
.assistant-dialog[open] { display: flex; flex-direction: column; gap: var(--space-3); }
.assistant-dialog:has(.assistant-context[open], .assistant-privacy[open]) { overflow-y: auto; }
.assistant-dialog:has(.assistant-context[open], .assistant-privacy[open]) .assistant-conversation { min-height: 48px; }
.assistant-dialog::backdrop { background: #0006; -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); }
.assistant-dialog :is(h2,h3,p) { margin: 0; }
.assistant-dialog button { min-height: 44px; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--text); cursor: pointer; }
.assistant-dialog button:hover { border-color: var(--accent); }
.assistant-dialog button:disabled { opacity: .5; cursor: wait; }
.assistant-dialog :is(button,textarea,summary,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.assistant-heading { flex: none; display: flex; align-items: center; gap: var(--space-2); }
.assistant-header-avatar { flex: none; width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.assistant-heading-copy { flex: 1; min-width: 0; }
.assistant-heading h2 { font-size: 16px; line-height: 1.35; letter-spacing: -.2px; }
.assistant-heading p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.assistant-heading button { flex: none; width: 44px; padding: var(--space-2); display: grid; place-items: center; background:transparent; border-color:transparent; }
.assistant-context { flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 0; }
.assistant-context summary { min-height: 44px; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); cursor: pointer; list-style: none; }
.assistant-context summary::-webkit-details-marker { display: none; }
.assistant-context-icon { display: flex; flex: none; }
.assistant-context strong { min-width: 0; flex: 1; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere; font-size: 12px; line-height:1.4; font-weight: 500; color: var(--muted); }
.assistant-context-chevron { flex: none; color: var(--accent); }
.assistant-context[open] .assistant-context-chevron { transform: rotate(180deg); }
.assistant-context-detail { padding: 0 var(--space-3) var(--space-3); max-height: 25dvh; overflow: auto; }
.assistant-context-detail p { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; margin-bottom: var(--space-2); }
.assistant-context-detail #assistant-source-detail { color:var(--text); font-weight:600; }
.assistant-context-detail button { font-size: 12px; }
.assistant-quick { flex: none; display: grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap: var(--space-2); }
.assistant-quick button { min-width: 0; padding-inline: var(--space-2); border-radius: 8px; background:var(--panel); font-size: 12px; line-height:1.3; overflow-wrap:anywhere; }
.assistant-quick button:hover:not(:disabled) { background:color-mix(in srgb,var(--accent) 7%,var(--panel)); }
.assistant-conversation { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; padding: var(--space-1) var(--space-2); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.assistant-welcome { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) 0; }
.assistant-welcome h3 { font-size: 18px; line-height:1.35; letter-spacing: -.3px; }
.assistant-welcome p { font-size: 14px; line-height: 1.55; }
.assistant-welcome > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.6; }
.assistant-message { margin-bottom: var(--space-5); }
.assistant-message-label { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); font-size: 11px; font-weight: 600; color: var(--muted); }
.assistant-message-body { font-size: 15px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message-user { margin-left: var(--space-6); padding: var(--space-3); border: 1px solid var(--line); border-radius: 12px 12px 4px 12px; background: var(--raised); }
.assistant-message-user .assistant-message-label { color: var(--text); }
.assistant-message-user .assistant-message-body { font-size: 14px; }
.assistant-message-assistant { margin-right: var(--space-2); }
.assistant-message-assistant > .assistant-message-label { color: var(--accent); }
.assistant-message[data-state='error'] .assistant-message-body, .assistant-message[data-state='stopped'] .assistant-message-meta { color: var(--muted); }
.assistant-thinking { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-weight: 400; }
.assistant-thinking-dots { display: inline-flex; gap: 3px; }
.assistant-thinking-dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); animation: companion-dot 1.4s ease-in-out infinite; }
.assistant-thinking-dots i:nth-child(2) { animation-delay: .16s; }
.assistant-thinking-dots i:nth-child(3) { animation-delay: .32s; }
.assistant-skeleton { display: grid; gap: var(--space-3); padding-block: var(--space-2); }
.assistant-skeleton span { height: 10px; border-radius: 6px; background: linear-gradient(100deg, var(--raised) 20%, var(--line) 48%, var(--raised) 76%); background-size: 220% 100%; animation: companion-shimmer 1.8s ease-in-out infinite; }
.assistant-skeleton span:nth-child(2) { width: 91%; }
.assistant-skeleton span:nth-child(3) { width: 96%; }
.assistant-skeleton span:nth-child(4) { width: 62%; }
.assistant-message-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); }
.assistant-message-meta { color: var(--muted); font-size: 11px; line-height: 1.5; }
.assistant-message-footer button { min-width: 44px; background: transparent; padding-inline: var(--space-2); font-size: 11px; border-color: transparent; }
#assistant-status { flex: none; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap:anywhere; }
#assistant-status:empty { display: none; }
#assistant-form { flex: none; display: grid; grid-template-columns: minmax(0,1fr) 44px; column-gap: var(--space-2); row-gap: var(--space-1); padding: var(--space-2); border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
#assistant-form:focus-within { border-color: var(--accent); }
#assistant-question { grid-column: 1; grid-row: 1; width: 100%; min-width:0; min-height: 44px; max-height: 120px; resize: none; overflow-y:auto; overflow-wrap:anywhere; padding: var(--space-2); border: 0; border-radius: 4px; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.5; }
#assistant-question:focus-visible { outline: none; }
#assistant-question::placeholder { color: var(--muted); opacity: 1; }
.assistant-composer-actions { display: contents; }
.assistant-composer-actions > span { grid-column: 1 / -1; grid-row: 2; color: var(--muted); font-size: 10px; }
#assistant-send { grid-column: 2; grid-row: 1; align-self: end; display: grid; place-items: center; width: 44px; height: 44px; padding: var(--space-2); border-radius: 8px; border-color: var(--accent); background: var(--accent); color: var(--bg); }
#assistant-send:hover { background: color-mix(in srgb,var(--accent) 88%,var(--text)); }
#assistant-send .ui-icon { color: inherit; width: 20px; height: 20px; }
.assistant-stop-icon { display: block; width: 12px; height: 12px; background: currentColor; border-radius: 2px; }
.assistant-privacy { flex: none; color: var(--muted); font-size: 11px; line-height: 1.5; }
.assistant-privacy summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); cursor: pointer; list-style: none; }
.assistant-privacy summary::-webkit-details-marker { display: none; }
.assistant-privacy summary span { text-decoration: underline; text-underline-offset: 3px; }
.assistant-privacy p { max-height: 15dvh; overflow: auto; }
@keyframes companion-shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
@keyframes companion-dot { 0%, 70%, 100% { opacity: .35; } 35% { opacity: 1; } }
@media (max-height: 650px) { .assistant-dialog[open] { gap: var(--space-2); } .assistant-heading p, .assistant-composer-actions > span { display: none; } #assistant-question { min-height: 44px; } .assistant-privacy summary { min-height: 44px; } }
@media (max-height: 450px) { .assistant-dialog[open] { overflow-y:auto; } .assistant-conversation { flex:1 0 48px; } }
@media (min-width: 701px) and (max-width: 1100px) { .page-actions > .assistant-trigger { --robot-size: 64px; } }
@media (max-width: 700px) { .page-actions > .assistant-trigger { --robot-size: 56px; } .assistant-composer-actions > span { display:none; } }
@media (prefers-reduced-motion: reduce) { .assistant-dialog *, .assistant-trigger * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
