/* ===== AI 仿生对话窗（前台） ===== */
.ai-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 14px 30px -10px rgba(14, 165, 233, .7);
    z-index: 9999;
    transition: transform .15s, opacity .2s;
}
.ai-launcher:hover { transform: translateY(-3px) scale(1.05); }
.ai-launcher.hidden { opacity: 0; pointer-events: none; transform: scale(.6); }

.ai-panel {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 360px;
    max-width: calc(100vw - 28px);
    height: 540px;
    max-height: calc(100vh - 44px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .45);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    border: 1px solid #e7eef6;
}
.ai-panel.open { display: flex; animation: aiPop .18s ease-out; }
@keyframes aiPop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.ai-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
}
.ai-ava { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; overflow: hidden; }
.ai-ava img, .ai-ava-img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; display: block; }
.ai-id { flex: 1; min-width: 0; }
.ai-title { font-weight: 800; font-size: 15px; }
.ai-sub { font-size: 12px; opacity: .85; }
.ai-close {
    background: rgba(255,255,255,.18);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 9px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.ai-close:hover { background: rgba(255,255,255,.3); }

.ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7fbff;
}
.ai-msg { display: flex; }
.ai-msg.ai-user { justify-content: flex-end; }
.ai-msg.ai-bot { justify-content: flex-start; }
.ai-bubble {
    max-width: 80%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.ai-user .ai-bubble { background: #0ea5e9; color: #fff; border-bottom-right-radius: 4px; }
.ai-bot .ai-bubble { background: #fff; color: #0f172a; border: 1px solid #e3edf6; border-bottom-left-radius: 4px; }
.ai-mini-ava {
    width: 30px; height: 30px; flex: none;
    border-radius: 9px; overflow: hidden;
    background: rgba(14,165,233,.12);
    display: grid; place-items: center;
    align-self: flex-end; margin-bottom: 2px;
}
.ai-mini-ava svg { width: 20px; height: 20px; color: #0ea5e9; }
.ai-mini-ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block; }

.ai-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e7eef6;
    background: #fff;
    align-items: flex-end;
}
.ai-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    outline: none;
}
.ai-input textarea:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
.ai-send {
    width: 42px; height: 42px; flex: none;
    border: none; border-radius: 12px;
    background: #0ea5e9; color: #fff;
    font-size: 16px; cursor: pointer;
}
.ai-send:disabled { opacity: .55; cursor: default; }
.ai-send:hover:not(:disabled) { background: #0284c7; }
