.aichat{--ac-bg:#fff;--ac-fg:#1f2328;--ac-mut:#6b7280;--ac-line:#e5e7eb;--ac-user:#1f2328;--ac-userfg:#fff;--ac-bot:#f3f4f6;--ac-acc:#2f6f5e;--ac-radius:16px;--ac-shadow:0 12px 40px rgba(0,0,0,.22);font-family:inherit;color:var(--ac-fg);box-sizing:border-box;-webkit-font-smoothing:antialiased}
.aichat *{box-sizing:border-box}
@media(prefers-color-scheme:dark){.aichat{--ac-bg:#1b1d1f;--ac-fg:#ececec;--ac-mut:#9ca3af;--ac-line:#33363a;--ac-user:#ececec;--ac-userfg:#1b1d1f;--ac-bot:#26292c;--ac-acc:#6fc2a9;--ac-shadow:0 12px 40px rgba(0,0,0,.6)}} .aichat-box{display:flex;flex-direction:column;background:var(--ac-bg);border:1px solid var(--ac-line);border-radius:var(--ac-radius);overflow:hidden;height:600px;max-height:80vh}
.aichat--inline{max-width:760px;margin:2rem auto}
.aichat--inline .aichat-box{box-shadow:0 2px 14px rgba(0,0,0,.06)} .aichat-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 18px;border-bottom:1px solid var(--ac-line);font-weight:600;background:linear-gradient(180deg,color-mix(in srgb,var(--ac-acc) 9%,var(--ac-bg)),var(--ac-bg))}
.aichat-head span{display:flex;align-items:center;gap:10px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aichat-head span::before{content:"";flex:none;width:9px;height:9px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px color-mix(in srgb,#22c55e 25%,transparent)}
.aichat-head button{flex:none;background:none;border:1px solid transparent;color:var(--ac-mut);cursor:pointer;font:inherit;font-size:.85rem;font-weight:500;padding:4px 10px;border-radius:8px;transition:color .15s,border-color .15s}
.aichat-head button:hover{color:var(--ac-fg);border-color:var(--ac-line)} .aichat-log{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:14px;scroll-behavior:smooth;scrollbar-width:thin;scrollbar-color:var(--ac-line) transparent}
.aichat-log::-webkit-scrollbar{width:8px}
.aichat-log::-webkit-scrollbar-thumb{background:var(--ac-line);border-radius:8px}
.aichat-msg{max-width:86%;padding:10px 14px;border-radius:14px;line-height:1.55;font-size:.97rem;word-wrap:break-word;overflow-wrap:anywhere;animation:aichat-in .22s ease-out}
@keyframes aichat-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.aichat-msg.user{align-self:flex-end;background:var(--ac-user);color:var(--ac-userfg);border-bottom-right-radius:4px;white-space:pre-wrap}
.aichat-msg.bot{align-self:flex-start;background:var(--ac-bot);border-bottom-left-radius:4px}
.aichat-msg.err{background:transparent;border:1px solid #d9534f;color:#d9534f}
.aichat-msg p{margin:0 0 .6em}.aichat-msg p:last-child{margin:0}
.aichat-msg ul,.aichat-msg ol{margin:.4em 0 .6em 1.2em;padding:0}
.aichat-msg li{margin:.15em 0}
.aichat-msg h3,.aichat-msg h4{margin:.7em 0 .3em;font-size:1em;font-weight:700;line-height:1.3}
.aichat-msg a{color:var(--ac-acc);text-decoration:underline;text-underline-offset:2px}
.aichat-msg code{background:rgba(127,127,127,.18);padding:1px 5px;border-radius:4px;font-size:.9em}
.aichat-msg pre{background:#14161a;color:#e8e8e8;padding:12px;border-radius:8px;overflow-x:auto;margin:.5em 0}
.aichat-msg pre code{background:none;padding:0;color:inherit} .aichat-dots{display:inline-flex;gap:4px;padding:4px 0}
.aichat-dots i{width:7px;height:7px;border-radius:50%;background:var(--ac-mut);animation:aichat-b 1.1s infinite}
.aichat-dots i:nth-child(2){animation-delay:.15s}.aichat-dots i:nth-child(3){animation-delay:.3s}
@keyframes aichat-b{0%,60%,100%{opacity:.25}30%{opacity:1}} .aichat-form{display:flex;gap:8px;align-items:flex-end;padding:12px;border-top:1px solid var(--ac-line)}
.aichat-form textarea{flex:1;resize:none;border:1px solid var(--ac-line);background:var(--ac-bg);color:var(--ac-fg);border-radius:12px;padding:10px 12px;font:inherit;font-size:16px;line-height:1.4;max-height:140px;min-height:42px;outline:none;transition:border-color .15s,box-shadow .15s}
.aichat-form textarea::placeholder{color:var(--ac-mut)}
.aichat-form textarea:focus{border-color:var(--ac-acc);box-shadow:0 0 0 2px color-mix(in srgb,var(--ac-acc) 25%,transparent)}
.aichat-form button{border:0;background:var(--ac-acc);color:#fff;border-radius:12px;height:42px;padding:0 18px;cursor:pointer;font:inherit;font-weight:600;transition:filter .15s,transform .1s}
.aichat-form button:hover:not(:disabled){filter:brightness(1.08)}
.aichat-form button:active:not(:disabled){transform:scale(.97)}
.aichat-form button:disabled{opacity:.5;cursor:default} .aichat--float{position:fixed;right:20px;bottom:20px;z-index:99999}
.aichat--float .aichat-box{width:380px;max-width:calc(100vw - 24px);height:560px;max-height:calc(100vh - 110px);position:absolute;right:0;bottom:68px;box-shadow:var(--ac-shadow);display:none;transform-origin:bottom right}
.aichat--float.open .aichat-box{display:flex;animation:aichat-pop .2s ease-out}
@keyframes aichat-pop{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}
.aichat-fab{width:56px;height:56px;border-radius:50%;border:0;background:var(--ac-acc);color:#fff;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;transition:transform .15s,box-shadow .15s}
.aichat-fab:hover{transform:scale(1.07);box-shadow:0 8px 26px rgba(0,0,0,.3)}
.aichat-fab svg{width:26px;height:26px}
.aichat button:focus-visible{outline:2px solid var(--ac-acc);outline-offset:2px} .aichat-src{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;padding-top:8px;border-top:1px solid var(--ac-line);font-size:.8rem;color:var(--ac-mut);align-items:center}
.aichat-src a{color:var(--ac-acc);text-decoration:none;border:1px solid var(--ac-line);border-radius:999px;padding:2px 10px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aichat-src a:hover{text-decoration:underline} @media(max-width:480px){
.aichat--float{right:12px;bottom:12px}
.aichat--float.open .aichat-box{position:fixed;inset:0;width:100vw;max-width:none;height:100%;max-height:none;border-radius:0;border:0}
.aichat--float.open .aichat-fab{position:fixed;right:12px;bottom:12px;visibility:hidden}
.aichat-msg{max-width:92%}
}
@media(prefers-reduced-motion:reduce){.aichat *{animation:none!important;transition:none!important}.aichat-log{scroll-behavior:auto}}
.aichat-msg img{display:block;max-width:100%;height:auto;border-radius:10px} .aichat-form .aichat-attbtn{flex:none;width:42px;height:42px;padding:0;border:1px solid var(--ac-line);background:var(--ac-bg);color:var(--ac-mut);border-radius:12px;display:flex;align-items:center;justify-content:center}
.aichat-form .aichat-attbtn:hover:not(:disabled){color:var(--ac-acc);border-color:var(--ac-acc);filter:none}
.aichat-attbtn svg{width:20px;height:20px}
.aichat-chips{display:none;flex-wrap:wrap;gap:10px;padding:12px 12px 0;border-top:1px solid var(--ac-line)}
.aichat-chips.on{display:flex}
.aichat-chips.on+.aichat-form{border-top:0}
.aichat-chip{position:relative;display:inline-flex;align-items:center;gap:6px;max-width:180px;padding:6px 10px;border:1px solid var(--ac-line);border-radius:10px;background:var(--ac-bot);font-size:.82rem;color:var(--ac-fg)}
.aichat-chip.is-img{padding:0;width:56px;height:56px}
.aichat-chip.is-img img{display:block;width:100%;height:100%;object-fit:cover;border-radius:10px}
.aichat-msg .aichat-chip.is-img img{height:100%;max-width:none}
.aichat-fic{flex:none;display:flex;color:var(--ac-acc)}
.aichat-fic svg{width:16px;height:16px}
.aichat-fn{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.aichat-x{position:absolute;top:-7px;right:-7px;width:20px;height:20px;padding:0;border-radius:50%;border:1px solid var(--ac-line);background:var(--ac-bg);color:var(--ac-fg);cursor:pointer;display:flex;align-items:center;justify-content:center}
.aichat-x svg{width:10px;height:10px}
.aichat-warn{display:none;padding:6px 14px 0;font-size:.8rem;color:var(--ac-mut)}
.aichat-warn.on{display:block}
.aichat-warn.err{color:#d9534f}
.aichat-atts{display:flex;flex-wrap:wrap;gap:6px;white-space:normal}
.aichat-atts+.aichat-ut{margin-top:8px}
.aichat-atts .aichat-chip{background:rgba(127,127,127,.22);border-color:transparent;color:inherit}
.aichat-atts .aichat-chip.is-img{width:100px;height:100px}
.aichat-atts .aichat-fic{color:inherit}
.aichat-box.is-drop{outline:2px dashed var(--ac-acc);outline-offset:-6px}