/* Full-height field conversation. Only the message chain scrolls. */
body.field-app.p-chat{padding:0;overflow:hidden;height:100dvh}.p-chat .chat-shell{position:fixed;top:var(--chat-top,0px);left:0;right:0;margin:0 auto;max-width:940px;height:var(--chat-height,calc(100dvh - 67px));display:flex;flex-direction:column;min-height:0;background:var(--bg);border-left:1px solid var(--line);border-right:1px solid var(--line)}.chat-header{flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-bottom:1px solid var(--line);background:var(--bg);z-index:3}.chat-title{display:flex;align-items:center;gap:10px;min-width:0}.chat-title h1{font:600 20px/1.2 var(--f);letter-spacing:-.03em;margin:0}.chat-title p{font-size:11px;line-height:1.3;color:var(--tx2);margin:3px 0 0}.chat-title img{flex:none}.chat-actions{display:flex;align-items:center;gap:8px}.chat-clear{background:var(--surface);color:var(--tx);border:1px solid var(--line2);border-radius:10px;padding:8px 12px;min-height:44px;font:600 12px var(--f);cursor:pointer}.chat-info{position:relative}.chat-info summary{list-style:none;display:grid;place-items:center;width:40px;height:44px;border-radius:10px;font:600 17px var(--display);color:var(--tx2);cursor:pointer}.chat-info summary::-webkit-details-marker{display:none}.chat-info>div{position:absolute;right:0;top:48px;width:min(290px,calc(100vw - 36px));padding:16px;background:var(--surface);border:1px solid var(--line2);border-radius:12px;font-size:13px;line-height:1.6;box-shadow:0 8px 24px #172d3515}.chat-info p{margin:0 0 10px}.chat-thread{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:20px 18px;scroll-behavior:auto}.chat-thread.is-empty{display:flex;align-items:center;justify-content:center}.chat-empty{text-align:center;color:var(--tx2);max-width:30ch;padding:20px}.chat-empty p{font:normal 29px/1.2 var(--display);letter-spacing:-.03em;color:var(--tx);margin:0 0 12px}.chat-empty small{font-size:13px}.chat-turn{display:flex;flex-direction:column;gap:0;padding:0 0 24px;overflow-wrap:anywhere}.chat-turn .chat-who{align-self:flex-end;margin:0 8px 5px;font-size:10px;color:var(--tx3)}.chat-turn h2.chat-user{align-self:flex-end;max-width:85%;margin:0 0 18px;padding:11px 15px;background:var(--tx);color:var(--surface);border-radius:18px 18px 4px 18px;font:500 15px/1.55 var(--f);letter-spacing:0}.chat-assistant{align-self:flex-start;max-width:92%;min-width:0;width:auto}.chat-speaker{display:flex;align-items:center;gap:7px;margin:0 0 7px 3px;font-size:11px;font-weight:650;color:var(--tx2)}.chat-speaker img{flex:none}.chat-answer{padding:13px 15px;background:var(--surface);border:1px solid var(--line);border-radius:4px 18px 18px 18px}.chat-reply{margin:0;font-size:15px;line-height:1.65;white-space:pre-line}.chat-reply[hidden],.chat-typing[hidden],.chat-empty[hidden]{display:none}.chat-typing{display:flex;align-items:center;flex-wrap:wrap;gap:12px;min-height:27px}.typing-dots{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 2px}.typing-dots i{display:block;width:7px;height:7px;border-radius:50%;background:var(--tx2);opacity:.5}.typing-stage{font-size:12px;color:var(--tx2)}.chat-typing:not([hidden]) .typing-dots i{animation:basecamp-typing 1.35s ease-in-out infinite}.chat-typing:not([hidden]) .typing-dots i:nth-child(2){animation-delay:.16s}.chat-typing:not([hidden]) .typing-dots i:nth-child(3){animation-delay:.32s}.chat-sources{display:grid;margin:10px 0 0 6px;border-left:2px solid var(--line);padding-left:11px}.chat-sources:empty,.chat-sources[hidden]{display:none}.chat-sources>a{display:flex;align-items:flex-start;min-height:44px;padding:8px 0;text-decoration:none;color:var(--tx);border-bottom:1px solid var(--line)}.chat-sources>a:last-child{border-bottom:0}.chat-sources .index{display:none}.chat-sources h3{font-size:13px;font-weight:650;line-height:1.4;letter-spacing:0;margin:0 0 3px}.chat-sources small{font-size:11px;color:var(--tx2)}.chat-sources>a>div{min-width:0}.chat-composer{flex:none;padding:12px 16px 8px;border-top:1px solid var(--line);background:var(--bg)}.p-chat #chat-form{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;margin:0;padding:5px 5px 5px 14px;border:1px solid var(--line2);background:var(--surface);border-radius:28px;max-width:100%}.p-chat #chat-form input{flex:1;min-width:0;width:auto;border:0;outline:none;background:transparent;color:var(--tx);padding:8px 0;font:16px/1.4 var(--f);height:auto}.p-chat #chat-form button{display:grid;place-items:center;flex:0 0 42px;width:42px;min-width:42px;height:42px;min-height:42px;padding:0;border:0;border-radius:50%;background:var(--orange);color:#fff;font:600 14px var(--f);cursor:pointer}.p-chat #chat-form button:disabled{opacity:.45;cursor:default}.p-chat #chat-form svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.chat-hint{font-size:10px;color:var(--tx3);line-height:1.35;margin:6px 6px 0;min-height:14px}.p-chat button:focus-visible,.p-chat a:focus-visible,.p-chat summary:focus-visible,.p-chat .chat-thread:focus-visible{outline:3px solid var(--orange);outline-offset:2px}.p-chat #chat-form:focus-within{border-color:var(--tx2);box-shadow:0 0 0 2px var(--ac-soft)}.p-chat .field-nav{bottom:var(--keyboard-inset,0px)}
@keyframes basecamp-typing{0%,60%,100%{transform:translateY(0);opacity:.4}30%{transform:translateY(-4px);opacity:1}}
@media(prefers-reduced-motion:reduce){.chat-typing:not([hidden]) .typing-dots i{animation:none;opacity:.7}}
@media(min-width:1050px){.p-chat .chat-shell{left:210px}.p-chat .field-nav{bottom:0}.chat-header{padding:16px 24px}.chat-thread{padding:24px 30px}.chat-composer{padding:14px 24px 12px}.chat-assistant{max-width:80%}}
@media(max-width:360px){.chat-header{padding:9px 12px}.chat-thread{padding:14px 12px}.chat-composer{padding:9px 10px 6px}.chat-title{gap:7px}.chat-actions{gap:2px}.chat-clear{padding:8px}.chat-title p{font-size:10px}}

.chat-meta{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:6px 6px 0;font-size:10px;line-height:1.35;color:var(--tx3);min-height:14px}.chat-meta .chat-hint{font:inherit;line-height:inherit;color:inherit;margin:0;min-height:0;min-width:0}.chat-meta #chat-model{flex:none;white-space:nowrap;text-align:right}

/* Saved chats (browser-only history) */
.p-chat .chat-shell{position:fixed}.chat-history{position:absolute;z-index:5;top:69px;right:12px;width:min(340px,calc(100% - 24px));max-height:calc(100% - 150px);display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line2);border-radius:12px;box-shadow:0 8px 24px #172d3515;padding:12px 12px 10px}.chat-history[hidden]{display:none}.history-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 6px 4px}.history-head h2{font:600 15px/1.3 var(--f);letter-spacing:-.01em;margin:0}.history-x{border:0;background:transparent;color:var(--tx2);font:400 22px/1 var(--f);width:40px;height:40px;border-radius:10px;cursor:pointer}.history-newchat{text-align:left;border:1px solid var(--line2);background:var(--bg);color:var(--tx);border-radius:10px;min-height:44px;padding:8px 12px;font:600 13px var(--f);cursor:pointer;margin:0 0 6px}.history-list{list-style:none;margin:0;padding:0;overflow-y:auto;min-height:0}.history-list li{display:flex;align-items:stretch;border-bottom:1px solid var(--line)}.history-list li:last-child{border-bottom:0}.history-open{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;text-align:left;border:0;background:transparent;color:var(--tx);padding:9px 6px;min-height:44px;border-radius:8px;cursor:pointer;font:500 13px/1.4 var(--f)}.history-open span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.history-open small{font-size:11px;color:var(--tx2)}.history-open[aria-current="true"] span{font-weight:650}.history-open[aria-current="true"]{background:var(--bg)}.history-delete{flex:none;width:40px;border:0;background:transparent;color:var(--tx3);font:400 18px var(--f);cursor:pointer;border-radius:8px}.history-empty{font-size:13px;color:var(--tx2);margin:6px 4px}.history-empty[hidden],.history-clear[hidden]{display:none}.history-clear{align-self:flex-start;border:0;background:transparent;color:var(--tx2);font:500 12px var(--f);text-decoration:underline;padding:8px 4px;min-height:40px;cursor:pointer}.chat-earlier{display:block;margin:0 auto 18px;border:1px solid var(--line2);background:var(--surface);color:var(--tx2);border-radius:999px;padding:6px 14px;min-height:36px;font:500 12px var(--f);cursor:pointer}.p-chat .chat-history button:focus-visible,.p-chat .chat-earlier:focus-visible{outline:3px solid var(--orange);outline-offset:2px}
@media(min-width:1050px){.chat-history{top:77px;right:24px}}
@media(max-width:360px){.chat-history{top:63px}.chat-history-btn{padding:8px 6px}}
.chat-clear{white-space:nowrap}.chat-title>div{min-width:0}.chat-title p{white-space:nowrap}
@media(max-width:520px){.chat-header{gap:6px;padding:10px 12px}.chat-actions{gap:4px}.chat-clear{padding:8px 10px}.chat-info summary{width:32px}}
@media(max-width:360px){.chat-title img{width:26px;height:26px}.chat-title h1{font-size:18px}.chat-clear{padding:8px 7px}.chat-info summary{width:28px}}

/* Thinking deeper: instant answer stays readable while the local model re-checks it. */
.chat-deeper{display:flex;align-items:center;gap:10px;margin:10px 0 0;padding:8px 0 0;border-top:1px solid var(--line);font-size:12px;color:var(--tx2)}.chat-deeper[hidden]{display:none}.chat-deeper .typing-dots{height:16px}.chat-deeper .typing-dots i{width:5px;height:5px}.chat-deeper:not([hidden]) .typing-dots i{animation:basecamp-typing 1.35s ease-in-out infinite}.chat-deeper:not([hidden]) .typing-dots i:nth-child(2){animation-delay:.16s}.chat-deeper:not([hidden]) .typing-dots i:nth-child(3){animation-delay:.32s}.chat-reply.is-refined{animation:basecamp-refined .45s ease-out}.chat-reply{transition:opacity .22s ease}.chat-reply.is-crossfade{opacity:0}.chat-reply.is-streaming::after{content:'';display:inline-block;width:.5em;height:1.05em;margin-left:.14em;background:currentColor;opacity:.55;vertical-align:-.15em;animation:basecamp-caret 1s steps(1,end) infinite}@keyframes basecamp-caret{50%{opacity:0}}
@keyframes basecamp-refined{from{opacity:.55}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.chat-deeper:not([hidden]) .typing-dots i{animation:none;opacity:.7}.chat-reply.is-refined{animation:none}.chat-reply.is-streaming::after{display:none;animation:none}.chat-reply{transition:none}}
.chat-excerpt-label{margin:0 0 6px;font-size:11px;font-weight:650;letter-spacing:.01em;color:var(--tx2)}.chat-excerpt-label[hidden]{display:none}.chat-reply[data-mode=excerpt]{color:var(--tx)}

/* Hide the searching dots as soon as answer text is visible. */
.chat-answer:has(.chat-reply:not([hidden])) .chat-typing{display:none!important}

/* Library matches + on-page Summarise (14 Nov 2026). Keeps the field palette. */
.chat-sources{display:grid;gap:10px;margin:10px 0 0;border-left:0;padding-left:0}
.chat-result{background:var(--paper, #f7f3ea);border:1px solid var(--line);border-radius:12px;padding:10px 12px 12px}
.chat-result>a{display:block;text-decoration:none;color:var(--tx);min-height:0;padding:0;border:0;align-items:unset}
.chat-result>a:hover h3{text-decoration:underline}
.chat-result h3{font-size:15px;font-weight:650;line-height:1.35;margin:0 0 2px;letter-spacing:0}
.chat-result small{font-size:11px;color:var(--tx2);display:block;margin:0 0 6px}
.chat-snippet{margin:0;font-size:13px;line-height:1.5;color:var(--tx);white-space:normal}
.chat-result-actions{display:flex;gap:8px;margin:10px 0 0}
.chat-summarise{appearance:none;min-height:44px;padding:8px 14px;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--tx);font:600 13px var(--f, inherit);cursor:pointer}
.chat-summarise:disabled{opacity:.5;cursor:default}
.chat-summary-box{margin:10px 0 0;padding:10px 0 0;border-top:1px solid var(--line)}
.chat-ai-label{margin:0 0 6px;font-size:11px;font-weight:650;letter-spacing:.02em;text-transform:uppercase;color:var(--tx2)}
.chat-summary{margin:0;font-size:15px;line-height:1.65;white-space:pre-line}
.chat-summary.is-streaming::after{content:'';display:inline-block;width:.5em;height:1.05em;margin-left:.14em;background:currentColor;opacity:.55;vertical-align:-.15em;animation:basecamp-caret 1s steps(1,end) infinite}
.chat-notice{margin:10px 0 0;padding:10px 12px;border-left:3px solid var(--orange,#c45c26);background:rgba(196,92,38,.08);border-radius:0 8px 8px 0;font-size:14px;line-height:1.55;color:var(--tx)}
.chat-reply[data-mode=results]{color:var(--tx);font-weight:550}
