/* Project writing assistant: quiet chrome, readable dialogue, explicit actions. */
#projectAIChat{--chat-ink:#373c42;--chat-muted:#7c828a;--chat-line:#dfe2e5;--chat-input:#f8f9fa;--chat-user:#eff1f3;--chat-hover:#e9ecef;}
html.dark-mode #projectAIChat{--chat-ink:#d9dce0;--chat-muted:#a1a6ae;--chat-line:#3c4045;--chat-input:#202224;--chat-user:#2c2f32;--chat-hover:#34383c;}
#editorView #projectAIChat .ai-work-heading{flex:none;display:flex;min-height:44px;box-sizing:border-box;padding:6px 12px;border:0;background:transparent;cursor:default;touch-action:auto;}
#projectAIChat .ai-chat-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:4px;width:100%;min-width:0;box-sizing:border-box;padding:4px 12px 0;flex:none;}
#projectAIChat .ai-chat-toolbar button{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:auto;min-width:0;height:30px;padding:5px 7px;border:0;border-radius:6px;background:transparent;color:var(--chat-muted);font:400 12px/20px system-ui;white-space:nowrap;cursor:pointer;}
#projectAIChat .ai-chat-toolbar button{color:var(--chat-muted);}
#projectAIChat .ai-chat-toolbar button:hover,#projectAIChat .ai-chat-toolbar button[aria-expanded=true]{background:var(--chat-hover);color:var(--chat-ink);}
#projectAIChat .ai-chat-toolbar button svg{width:18px;height:18px;flex:none;stroke-width:1.65;}
#projectAIChat .ai-chat-toolbar button .ai-history-chevron{width:12px;height:12px;margin-left:-3px;}
#projectAIChat .ai-chat-toolbar button:focus-visible{outline:1px solid var(--chat-muted);outline-offset:2px;}
#editorView #projectAIChat #aiChatMsgs{gap:18px;padding:14px 16px 20px;scroll-padding-block:12px;background:transparent;overscroll-behavior:contain;}
#projectAIChat #aiChatMsgs .chat-bubble{font:400 13px/1.75 system-ui;color:var(--chat-ink);overflow-wrap:anywhere;}
#projectAIChat #aiChatMsgs .chat-msg.user>.chat-bubble{max-width:88%;padding:9px 12px;border:0;border-radius:11px;background:var(--chat-user);color:var(--chat-ink);box-shadow:none;}
#projectAIChat #aiChatMsgs .chat-msg.ai>.chat-bubble{max-width:100%;width:100%;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;}
#projectAIChat #aiChatMsgs .ai-markdown>:first-child{margin-top:0;}
#projectAIChat #aiChatMsgs .ai-markdown>:last-child{margin-bottom:0;}
#editorView #projectAIChat .ai-chat-chips{display:flex;flex-wrap:wrap;gap:4px;padding:4px 12px 8px;overflow-x:visible;scrollbar-width:thin;scrollbar-color:#8884 transparent;}
#projectAIChat.selection-mode .ai-chat-chips{display:none!important;}
#projectAIChat .ai-chat-chips button{flex:none;min-height:26px;padding:3px 8px;border:0;border-radius:5px;background:transparent;color:var(--chat-muted);font:400 11px/20px system-ui;white-space:nowrap;}
#projectAIChat .ai-chat-chips button:hover{background:var(--chat-hover);color:var(--chat-ink);}
#editorView #projectAIChat .ai-chat-input{flex:none;padding:0 12px 12px;border:0;background:transparent;}
#projectAIChat .ai-input-wrap{position:relative;display:flex;box-sizing:border-box;min-width:0;border:1px solid var(--chat-line);border-radius:12px;background:var(--chat-input);}
#editorView #projectAIChat #aiChatInput,#editorView #projectAIChat #aiChatInput:focus{box-sizing:border-box;width:100%;min-height:100px;max-height:180px;padding:11px 12px 44px;margin:0;border:0;border-radius:12px;outline:none!important;box-shadow:none!important;background:transparent;color:var(--chat-ink);font:400 13px/1.65 system-ui;resize:none;}
#projectAIChat #aiChatInput::placeholder{color:var(--chat-muted);}
#projectAIChat .ai-send-btn{position:absolute;right:8px;bottom:8px;display:grid;place-items:center;box-sizing:border-box;width:30px;height:30px;padding:0;border:0;border-radius:50%;background:var(--brand);color:#fff;box-shadow:none;line-height:1;cursor:pointer;}
#projectAIChat .ai-send-btn svg{width:18px;height:18px;}
#projectAIChat .ai-send-btn:hover{opacity:.8;}
#projectAIChat .ai-send-btn:focus-visible{outline:1px solid var(--chat-muted);outline-offset:2px;}
.ai-chat-history-dialog[popover]{position:fixed;inset:auto;margin:0;box-sizing:border-box;width:300px;max-width:calc(100vw - 24px);max-height:70dvh;overflow:auto;padding:10px;border:1px solid #dfe2e5;border-radius:9px;background:#fff;color:#373c42;box-shadow:0 5px 20px #00000018;}
.ai-chat-history-dialog::backdrop{background:transparent;}
.ai-chat-history-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 4px 6px;font:400 12px/20px system-ui;}
.ai-chat-history-dialog header strong{font-weight:500;}
.ai-chat-history-dialog header button{display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:4px;background:transparent;color:#7c828a;font:20px/1 system-ui;cursor:pointer;}
.ai-chat-history-item{display:flex;flex-direction:column;gap:3px;width:100%;padding:9px 8px;text-align:left;border:0;border-radius:5px;background:transparent;color:inherit;font:12px/18px system-ui;cursor:pointer;}
.ai-chat-history-item span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ai-chat-history-item small,.ai-chat-history-dialog p{font:400 11px/18px system-ui;color:#7c828a;}
.ai-chat-history-dialog p{padding:8px;margin:0;}
.ai-chat-history-dialog button:hover{background:#88888812;}
.ai-chat-history-dialog button:focus-visible{outline:1px solid #90969e;outline-offset:-1px;}
html.dark-mode .ai-chat-history-dialog{background:#242628;border-color:#3c4045;color:#d9dce0;}
html.dark-mode .ai-chat-history-item small,html.dark-mode .ai-chat-history-dialog p{color:#a1a6ae;}
@media(max-width:820px){#editorView #projectAIChat #aiChatInput,#editorView #projectAIChat #aiChatInput:focus{font-size:16px;}#projectAIChat #aiChatMsgs .chat-msg.user>.chat-bubble{max-width:92%;}}

.ai-chat-history-item[aria-current="true"]{background:#88888812;}

.ai-chat-history-row{display:flex;align-items:center;gap:4px;min-width:0;}
.ai-chat-history-row>.ai-chat-history-item{flex:1;min-width:0;}
.ai-chat-history-delete{display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;padding:6px;border:0;border-radius:5px;background:transparent;color:#91979c;cursor:pointer;}
.ai-chat-history-delete svg{width:16px;height:16px;}
.ai-chat-history-delete:hover{color:#bb5656;}
