.erp-chat{max-width:980px;margin:0 auto 1.5rem;overflow:hidden;background:#fff}.chat-top{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.15rem 1.4rem;border-bottom:1px solid #e2e9e6;background:#f4f8f6}.chat-top strong{font-size:1.15rem;color:#205d46}.chat-top p{margin:.3rem 0 0;color:#53655b;font-size:.9rem}.chat-history,.chat-team{padding:.7rem 1.4rem;border-bottom:1px solid #e2e9e6}.erp-chat summary{cursor:pointer;font-weight:600}.chat-history nav{max-height:220px;overflow:auto;display:grid;gap:.35rem;margin-top:.7rem}.chat-history nav button{text-align:left;background:#fff;border:1px solid #dce6e0;padding:.7rem;border-radius:.5rem;overflow-wrap:anywhere}.chat-history nav button[aria-current]{border-color:#347657;background:#f0f7f3}.chat-history small{display:block;color:#65766b}.chat-provider{padding:0 1.4rem;font-size:.82rem;color:#65766b}.erp-chat [data-chat-log]{min-height:260px;max-height:55vh;overflow-y:auto;overscroll-behavior:contain;padding:.5rem 1.4rem 1.4rem;display:flex;flex-direction:column;gap:1rem}.chat-message{padding:1rem 1.15rem;max-width:88%;border-radius:1rem;overflow-wrap:anywhere}.chat-message strong{font-size:.82rem}.chat-message p{white-space:pre-wrap;margin:.5rem 0 0;line-height:1.65}.chat-assistant{align-self:flex-start;background:#f2f5f3;color:#253c2f}.chat-user{align-self:flex-end;background:#e6f2e9;color:#20472f}.chat-examples{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:1rem}.chat-examples button{font-size:.85rem}.erp-chat [data-chat-status]{min-height:1.5rem;padding:0 1.4rem;color:#50685b;font-size:.9rem}.erp-chat [data-chat-status][aria-busy=true]::before{content:'●';display:inline-block;margin-right:.5rem;color:#33845d;animation:chat-pulse 1.2s infinite}@keyframes chat-pulse{50%{opacity:.35}}.erp-chat form[data-ai-chat]{padding:1rem 1.4rem;border-top:1px solid #e2e9e6;background:#fcfdfc;position:relative}.erp-chat label{display:block;margin-bottom:.45rem;font-weight:600}.erp-chat textarea{width:100%;min-height:95px;max-height:240px;resize:vertical;border:1px solid #a9bcae;border-radius:.7rem;padding:.8rem;font:inherit;line-height:1.5;box-sizing:border-box}.erp-chat textarea:focus{outline:2px solid #347657;outline-offset:2px}.chat-compose-actions{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin-top:.65rem}.chat-compose-actions small{color:#63776a}.chat-compose-actions button{min-width:125px;min-height:44px;background:#276947;color:#fff}.chat-compose-actions button:disabled{opacity:.55}.erp-chat [data-chat-error]{color:#a32727;margin:.6rem 0 0}.chat-options{display:flex;flex-wrap:wrap;gap:.5rem;padding:.5rem 1.4rem}.chat-options button{white-space:normal;text-align:left;max-width:100%}.chat-preview{margin:1rem 1.4rem;padding:1.1rem;border:1px solid #a4c6b0;border-radius:.75rem;background:#fafdfb;overflow-wrap:anywhere}.chat-preview dl{margin:.4rem 0}.chat-preview dl>div{display:grid;grid-template-columns:minmax(110px,1fr) minmax(0,2fr);gap:.7rem;border-bottom:1px solid #e1eae4;padding:.35rem 0}.chat-preview dd{margin:0;white-space:pre-wrap}.chat-preview dt{color:#5d7064}.chat-total{font-size:1.15rem}.chat-result{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;padding:1rem 1.4rem;color:#205d46;background:#edf7ef}.chat-advanced{margin:1rem auto;max-width:980px}.chat-advanced>summary{cursor:pointer;color:#526b5a}.chat-team [data-chat-team]{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem}.chat-team p{font-size:.85rem;line-height:1.5}.erp-chat [data-chat-followup]>button{margin:.4rem 1.4rem}
@media(max-width:600px){.chat-top,.chat-history,.chat-team{padding:.85rem}.chat-top{align-items:flex-start}.chat-top .btn{padding:.5rem;font-size:.82rem;min-width:85px}.erp-chat [data-chat-log]{padding:.5rem .75rem 1rem;max-height:50vh}.chat-message{max-width:95%;padding:.85rem}.chat-compose-actions{align-items:stretch}.chat-compose-actions small{font-size:.7rem;max-width:150px}.erp-chat form[data-ai-chat]{padding:.85rem}.chat-preview{margin:.7rem;padding:.8rem}.chat-preview dl>div{grid-template-columns:1fr}.chat-preview dd{padding-left:.4rem}.chat-preview th,.chat-preview td{padding:.4rem;font-size:.85rem}.chat-provider{padding:0 .85rem}.chat-options{padding:.5rem .85rem}.chat-options .btn{width:100%}.chat-examples .btn{white-space:normal}.erp-chat{border-radius:.7rem}}
@media(prefers-reduced-motion:reduce){.erp-chat [data-chat-status][aria-busy=true]::before{animation:none}}

/* Keep the composer close to the conversation despite shared legacy form styles. */
.erp-chat>.chat-history,.erp-chat>.chat-team{margin:0;border-top:0}.erp-chat>.chat-history>summary,.erp-chat>.chat-team>summary{margin:0}.erp-chat .chat-provider{margin:.65rem 0}.erp-chat [data-chat-log]{min-height:180px;max-height:clamp(180px,calc(100dvh - 640px),420px)}.erp-chat [data-chat-status]{margin:.65rem 0}.erp-chat [data-chat-error]:empty{display:none}.erp-chat textarea{min-height:80px}.chat-preview details{margin:.8rem 0}.chat-preview summary{margin:0}@media(max-width:600px){.erp-chat [data-chat-log]{max-height:clamp(180px,calc(100dvh - 610px),350px)}}

.chat-top-actions{display:flex;gap:.5rem;flex-wrap:wrap}.chat-input-help,.chat-file-row small{font-size:.8rem;color:#53655b}.chat-file-row{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:.65rem 0}.erp-chat .chat-file-label{position:relative;overflow:hidden;display:inline-flex;align-items:center;margin:0;min-height:44px;cursor:pointer}.chat-file-label input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%}.chat-attached{padding:.7rem;background:#edf5ef;border-radius:.6rem;overflow-wrap:anywhere}.chat-attached button{margin:.4rem}.chat-attached pre{max-height:200px;overflow:auto;white-space:pre-wrap;word-break:break-word;font:inherit;font-size:.85rem}.chat-file-received{font-size:.85rem;font-weight:600}.chat-estimate{background:#fff7d9;border:1px solid #d9bd5d;border-radius:.5rem;padding:.8rem;margin-bottom:1rem}.chat-estimate p{margin:.5rem 0}.erp-chat [data-chat-document-warning]:not(:empty){margin:.7rem 1.4rem;padding:.75rem;background:#fff7d9;border-radius:.5rem}.erp-chat [data-chat-document-warning]:empty{display:none}@media(max-width:600px){.chat-top{flex-wrap:wrap}.chat-top-actions{width:100%}.chat-top-actions .btn{flex:1}.chat-file-row small{font-size:.75rem}}

[data-chat-remember]{font-size:.85rem;padding:5px 9px;margin-top:4px}.chat-top-actions{flex-wrap:wrap}[data-memory-form] textarea{min-height:130px;max-width:100%}[data-memory-form] p{overflow-wrap:anywhere}[data-chat-memory-status]:empty{display:none}

.chat-context-choice{padding:.75rem;border:1px solid #b8cfbf;border-radius:.6rem;background:#fff}.chat-context-choice .btn{margin:.2rem;white-space:normal}.chat-provisional{border:1px dashed #7a9b88}.chat-provisional strong{color:#5d6f63}

.chat-tool-result{padding:.8rem 1.4rem;overflow-wrap:anywhere}.chat-tool-card{padding:.85rem;margin:.5rem 0;border:1px solid #cadbd0;border-radius:.7rem;background:#fbfdfb}.chat-tool-card dl>div{display:grid;grid-template-columns:1fr 2fr;gap:.6rem;margin:.3rem 0}.chat-tool-card dd{margin:0}.chat-tool-card dt,.chat-tool-result small{color:#576e5f}.chat-tool-result h3{font-size:1rem}@media(max-width:600px){.chat-tool-result{padding:.7rem}.chat-tool-card dl>div{grid-template-columns:1fr}.chat-tool-card dd{padding-left:.3rem}}

.chat-provisional small{display:block;margin-top:.25rem;color:#5d6f63}

.erp-chat.chat-dragover{outline:3px dashed #347657;outline-offset:-4px;background:#edf7ef}.erp-chat.chat-dragover [data-chat-log],.erp-chat.chat-dragover form[data-ai-chat]{background:#edf7ef}
.chat-file-warnings{padding:.6rem .6rem .6rem 1.7rem;background:#fff7d9;border:1px solid #d9bd5d;border-radius:.5rem;font-size:.85rem;overflow-wrap:anywhere}.chat-file-warnings li+li{margin-top:.3rem}
