/* Chat layout owns its viewport; account button/card styles do not participate. */
body.has-account-sidebar.in-account:has(.chat-screen){overflow:hidden}
body.has-account-sidebar.in-account .account-layout:has(.chat-screen){height:100dvh;min-height:0;padding:0;overflow:hidden}
.account-content:has(>.chat-screen){display:flex;flex-direction:column;height:100%;min-height:0;min-width:0}
.account-content:has(>.chat-screen)>.workspace-feedback:not([hidden]){flex-shrink:0;margin:8px 24px 0}
.chat-screen{display:flex;flex-direction:column;flex:1;height:100%;min-height:0;min-width:0;color:var(--ink)}
.chat-header{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;min-height:60px;padding:10px 28px;gap:16px}
.chat-header h1{font-size:19px;line-height:1.3;letter-spacing:-.035em;font-weight:650}
.chat-header h1 span{font-weight:400;color:var(--muted);margin-left:3px}
.chat-screen button{font:inherit;cursor:pointer}
.chat-screen button:disabled{cursor:default;opacity:.5}
.chat-icon-button{display:grid;place-items:center;width:38px;height:38px;padding:0;border:0;border-radius:9px;background:transparent;color:var(--green)}
.chat-icon-button:hover{background:#e9ede3}
.chat-icon-button svg,.chat-context-button svg,.chat-send svg{display:block;flex-shrink:0}
.chat-connection{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-shrink:0;max-width:760px;width:calc(100% - 48px);margin:0 auto 8px;padding:10px 14px;border:1px solid var(--line);border-radius:10px;font-size:12px;color:var(--muted)}
.chat-connection button,.chat-connection a{border:0;background:none;color:var(--green);text-decoration:underline;font-size:12px;white-space:nowrap}
.chat-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;outline-offset:-4px}
.chat-column{display:flex;flex-direction:column;gap:26px;width:100%;max-width:800px;margin:0 auto;padding:24px 24px 36px}
.chat-message{display:block;flex:0 0 auto;min-width:0;max-width:100%;overflow-wrap:anywhere}
.chat-message--user{align-self:flex-end;width:fit-content;max-width:85%;padding:11px 18px;background:#e9ede3;border-radius:22px}
.chat-message--assistant{width:100%;align-self:stretch;padding:0;background:none}
.chat-message-text{font-size:15px;line-height:1.8;white-space:pre-wrap;color:var(--ink)}
.chat-message-text a{color:var(--green);text-decoration:underline;text-underline-offset:3px}
.chat-message-status{font-size:11px;margin-top:6px;color:var(--muted)}
.chat-sent-context{font-size:11px;margin-top:10px;color:var(--muted)}
.chat-sent-context summary{cursor:pointer}.chat-sent-context ul{padding-left:18px}.chat-sent-context p{margin-top:8px}
.chat-thinking{display:flex;align-items:center;gap:3px;min-height:24px;font-size:14px;line-height:1.5;color:var(--muted)}
.chat-thinking-label{display:inline-block}
.chat-thinking-dots{display:inline-flex;align-items:center;gap:4px;width:24px;height:18px;margin-left:2px}
.chat-thinking-dots>i{display:block;width:4px;height:4px;flex:0 0 4px;border-radius:50%;background:currentColor;animation:chat-thinking-dot 1.4s ease-in-out infinite}
.chat-thinking-dots>i:nth-child(2){animation-delay:.16s}.chat-thinking-dots>i:nth-child(3){animation-delay:.32s}
@keyframes chat-thinking-dot{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
.chat-send-wait{display:block;width:8px;height:8px;border-radius:50%;background:currentColor;animation:chat-pulse 1.2s ease-in-out infinite}
.chat-session-note{padding:12px 14px;border:1px solid #dfd3bb;border-radius:10px;font-size:12px;line-height:1.6;background:#fff9ed}
.chat-scroll--empty{display:flex;align-items:center;justify-content:center}
.chat-empty{width:100%;max-width:760px;padding:24px;text-align:center}
.chat-empty h2{font-size:28px;line-height:1.3;font-weight:600;letter-spacing:-.04em;margin:0 0 22px}
.chat-prompts{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}
.chat-prompts button{padding:9px 13px;border:1px solid var(--line);border-radius:20px;font-size:12px;background:transparent;color:var(--green);line-height:1.5}
.chat-prompts button:hover{border-color:#97aa8b}
.chat-compose-zone{flex:0 0 auto;width:100%;max-width:800px;margin:0 auto;padding:8px 24px max(12px,env(safe-area-inset-bottom))}
.chat-composer{display:block;border:1px solid #d6ddce;border-radius:24px;background:#fff;padding:12px 14px 10px;box-shadow:0 3px 15px #192e2905}
.chat-composer:focus-within{border-color:#98ab8b}
.chat-composer textarea{display:block;width:100%;height:30px;min-height:30px;max-height:176px;margin:0;padding:3px 7px;border:0;border-radius:0;background:transparent;font:inherit;font-size:15px;line-height:24px;color:var(--ink);resize:none;overflow-y:auto;box-shadow:none}
.chat-composer textarea:focus-visible{outline:0}
.chat-composer textarea::placeholder{color:#879081}
.chat-compose-bottom{display:flex;align-items:center;gap:12px;margin-top:7px}
.chat-context-button{display:flex;align-items:center;gap:7px;min-height:36px;border:0;background:transparent;color:#64715c;padding:5px 6px;border-radius:10px;font-size:12px!important}
.chat-context-button:hover{background:#f0f3eb}
.chat-character-count{margin-left:auto;color:var(--muted);font-size:10px;white-space:nowrap}
.chat-screen .chat-send{display:grid;place-items:center;margin-left:auto;width:36px;height:36px;min-height:36px;padding:0;border:1px solid #becbb4;border-radius:50%;background:transparent;color:var(--green);box-shadow:none;transform:none}
.chat-screen .chat-send:hover{border-color:#6c8d58;background:transparent}
.chat-send-wait{width:7px;height:7px}
.chat-footnote{position:relative;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px 10px;margin-top:10px;font-size:10px;line-height:1.5;color:#8a9283}
.chat-data-note>summary{cursor:pointer;text-decoration:underline;list-style:none}.chat-data-note>summary::-webkit-details-marker{display:none}
.chat-data-note .assistant-privacy{position:absolute;bottom:calc(100% + 12px);left:0;right:0;max-height:200px;overflow:auto;margin:0;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:#fff;box-shadow:0 8px 28px #192e2912;font-size:12px;line-height:1.7;color:var(--muted);z-index:10}
.assistant-privacy a{text-decoration:underline;color:var(--green)}
.chat-attachment{padding:4px 7px 12px;margin-bottom:8px;border-bottom:1px solid var(--line);font-size:12px;color:var(--muted)}
.chat-attachment summary{cursor:pointer;color:var(--green)}.chat-attachment p{margin-top:10px}.chat-attachment ul{padding-left:18px}.chat-attachment .text-button{margin-top:8px;font-size:11px}
.chat-error{display:flex;align-items:center;gap:14px;margin-bottom:10px;padding:12px 14px;border:1px solid #e1c9aa;border-radius:12px;background:#fff8ed;font-size:12px;line-height:1.6}
.chat-error p{flex:1;min-width:0}.chat-error button{border:0;background:none;text-decoration:underline;font-size:11px;color:var(--green)}
.chat-sidebar-history{display:none}
body.has-account-sidebar .account-sidebar.is-expanded:has(.chat-sidebar-history) nav{flex:0 1 auto;max-height:48dvh;padding-bottom:10px}
body.has-account-sidebar .account-sidebar.is-expanded .chat-sidebar-history{display:flex;flex-direction:column;flex:1;min-height:80px;margin:4px 0 10px;padding:12px 4px 0;border-top:1px solid var(--line);overflow:hidden}
.chat-sidebar-new{display:flex;align-items:center;gap:10px;flex-shrink:0;width:100%;min-height:38px;padding:8px;border:0;border-radius:9px;background:transparent;color:var(--green);font:inherit;font-size:12px;text-align:left;cursor:pointer}
.chat-sidebar-new:hover{background:#e9eee1}
.chat-sidebar-history h2{font-size:10px;line-height:1.4;font-weight:500;letter-spacing:0;color:#909a86;padding:14px 8px 8px;margin:0}
.chat-thread-list{min-height:0;overflow:auto;overscroll-behavior:contain}
.chat-thread-list a{display:block;padding:9px 10px;border-radius:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#697368;text-decoration:none}
.chat-thread-list a:hover,.chat-thread-list a[aria-current]{background:#e6eddc;color:var(--green)}
.chat-thread-list p{font-size:11px;padding:8px;line-height:1.6}
@keyframes chat-pulse{50%{opacity:.35}}
@media(max-width:680px){
 .chat-header{min-height:62px;padding:10px 18px 10px 78px}.chat-header h1{font-size:18px}
 .chat-column{padding:18px 18px 28px;gap:24px}.chat-message-text{font-size:15px;line-height:1.75}.chat-message--user{max-width:90%;padding:10px 15px}
 .chat-compose-zone{padding:6px 12px max(10px,env(safe-area-inset-bottom))}.chat-composer{border-radius:22px;padding:11px 11px 9px}.chat-composer textarea{font-size:16px;line-height:24px}.chat-context-button,.chat-screen .chat-send{min-height:40px}.chat-screen .chat-send{width:40px;height:40px}.chat-context-button{padding:6px}.chat-footnote{font-size:9px;margin-top:8px}
 .chat-empty{padding:20px}.chat-empty h2{font-size:26px;margin-bottom:20px}.chat-prompts{gap:8px}.chat-prompts button{min-height:44px;font-size:11px;padding:9px 12px}
 .chat-connection{width:calc(100% - 28px);font-size:11px}.chat-data-note .assistant-privacy{font-size:12px}
 body.has-account-sidebar .account-sidebar.is-expanded:has(.chat-sidebar-history) nav{max-height:43dvh}
}
@media(prefers-reduced-motion:reduce){.chat-thinking-dots>i,.chat-send-wait{animation:none;transform:none;opacity:.7}}
/* Compact per-chat actions, independent of the account's navigation links. */
.chat-thread-row{border-radius:9px;margin-bottom:3px}
.chat-thread-row.is-current{background:#e6eddc}
.chat-thread-title{display:flex;align-items:center;min-width:0}
.chat-thread-title>a{flex:1;min-width:0}
.chat-thread-title .chat-thread-more{display:grid;place-items:center;flex-shrink:0;width:30px;height:32px;min-height:32px;padding:0;margin-right:4px;border:0;border-radius:7px;background:transparent;color:#6e7b62;font-size:21px;line-height:1;cursor:pointer}
.chat-thread-more:hover,.chat-thread-more[aria-expanded=true]{background:#dce5d3;color:var(--green)}
.chat-thread-actions{display:flex;gap:4px;padding:3px 6px 7px}
.chat-thread-actions button{min-height:32px;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:var(--green);font:inherit;font-size:11px;cursor:pointer}
.chat-thread-actions button:hover{background:#dde6d4}
.chat-thread-actions [data-chat-delete]{color:#954a3d}
.chat-thread-actions button:disabled{opacity:.45;cursor:default}
#chat-thread-dialog{width:min(430px,calc(100% - 32px));padding:26px;border-radius:18px}
#chat-thread-dialog h2{font-size:23px;line-height:1.3;margin:0 0 20px}
#chat-thread-dialog p{font-size:13px;line-height:1.7;margin:0 0 16px;overflow-wrap:anywhere}
#chat-thread-dialog .chat-dialog-hint{font-size:11px;color:var(--muted);margin-top:10px}
#chat-thread-dialog a{text-decoration:underline}
#chat-thread-name{width:100%;min-height:44px;border:1px solid #cbd5c3;border-radius:9px;padding:10px 12px;font:inherit;font-size:15px;color:var(--ink);background:#fff}
.chat-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}
.chat-dialog-actions button{min-height:38px;padding:8px 14px;border:1px solid var(--line);border-radius:8px;background:transparent;color:var(--green);font:inherit;font-size:12px;cursor:pointer}
.chat-dialog-actions button:hover{border-color:#97aa89}
.chat-dialog-actions .chat-delete-confirm{color:#934b3e;border-color:#d6b7ac}
@media(max-width:680px){.chat-thread-title .chat-thread-more{width:40px;height:44px}.chat-thread-actions button{min-height:44px}.chat-dialog-actions button{min-height:44px}#chat-thread-name{font-size:16px}}

.chat-resend{width:min(100%,760px);margin:0 auto;padding:8px 20px;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px 14px}
.chat-resend small{font-size:11px;line-height:1.5;color:var(--muted)}
