/* LiteQuant 智能客服：与价格页一致的轻量 SaaS 视觉。 */
:root {
    --lq-chat-blue: #2563eb;
    --lq-chat-blue-soft: #eff6ff;
    --lq-chat-ink: #172033;
    --lq-chat-muted: #64748b;
    --lq-chat-border: #e2e8f0;
    --lq-chat-surface: #ffffff;
    --lq-chat-canvas: #f6f9fd;
    --lq-chat-success: #10b981;
}

.lq-chat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    display: flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.64);
    border-radius: 50%;
    color: #fff;
    background: var(--lq-chat-blue);
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.24);
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lq-chat-fab[hidden] { display: none !important; }
.lq-chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
}

.lq-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    width: 440px;
    max-width: calc(100vw - 32px);
    height: 650px;
    max-height: calc(100vh - 48px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: var(--lq-chat-surface);
    box-shadow: 0 18px 48px rgba(36, 55, 87, 0.16), 0 2px 8px rgba(36, 55, 87, 0.06);
}

.lq-chat-panel[hidden] { display: none; }

.lq-chat-header {
    display: flex;
    min-height: 82px;
    box-sizing: border-box;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 14px 18px;
    border-bottom: 1px solid #e8eef7;
    color: var(--lq-chat-ink);
    background: #fff;
}

.lq-chat-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 13px;
}

.lq-chat-avatar {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    color: var(--lq-chat-blue);
    background: var(--lq-chat-blue-soft);
    font-size: 23px;
}

.lq-chat-identity > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.lq-chat-identity strong {
    overflow: hidden;
    color: var(--lq-chat-ink);
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lq-chat-identity small {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--lq-chat-muted);
    font-size: 16px;
    font-weight: 500;
}

.lq-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lq-chat-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.lq-chat-status-dot.connecting { background: #3b82f6; animation: lq-chat-pulse 1.1s infinite; }
.lq-chat-status-dot.busy { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }
.lq-chat-status-dot.unavailable { background: #94a3b8; box-shadow: none; }

.lq-chat-close {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    color: #718096;
    background: transparent;
    font-size: 29px;
    line-height: 1;
    cursor: pointer;
}
.lq-chat-close:hover { color: var(--lq-chat-ink); background: #f1f5f9; }

.lq-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 17px 16px 19px;
    background: var(--lq-chat-canvas);
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

.lq-chat-welcome-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lq-chat-welcome {
    padding: 14px 15px;
    border: 1px solid var(--lq-chat-border);
    border-radius: 7px 14px 14px 14px;
    color: #1e293b;
    background: #fff;
    box-shadow: 0 2px 7px rgba(51, 65, 85, 0.035);
}
.lq-chat-welcome strong { display: block; margin-bottom: 7px; font-size: 19px; font-weight: 700; }
.lq-chat-welcome p { margin: 0; color: #475569; font-size: 18px; line-height: 1.6; }

.lq-chat-suggestion-label {
    color: #8290a3;
    font-size: 15px;
    font-weight: 600;
}

.lq-chat-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.lq-chat-suggestion {
    min-height: 44px;
    overflow: hidden;
    padding: 8px 10px;
    border: 1px solid #cfe0ff;
    border-radius: 8px;
    color: #315fba;
    background: rgba(255, 255, 255, 0.88);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}
.lq-chat-suggestion:hover { border-color: #94b8ff; color: #1d4ed8; background: #f2f7ff; }

.lq-chat-msg {
    max-width: 88%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 18px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.lq-chat-msg.bot {
    align-self: flex-start;
    border: 1px solid #e5eaf2;
    border-radius: 6px 15px 15px 15px;
    color: #1e293b;
    background: #fff;
}
.lq-chat-msg.user {
    align-self: flex-end;
    border-radius: 15px 6px 15px 15px;
    color: #fff;
    background: var(--lq-chat-blue);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.14);
}
.lq-chat-msg.error {
    align-self: flex-start;
    border: 1px solid #fed7aa;
    border-radius: 6px 15px 15px 15px;
    color: #9a3412;
    background: #fffaf5;
}
.lq-chat-msg.typing { display: flex; align-items: center; gap: 8px; color: #64748b; }
.lq-chat-msg.streaming::after {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 3px;
    background: #64748b;
    vertical-align: -0.1em;
    content: '';
}
.lq-chat-msg.incomplete { border-color: #e5cfa4; }
.lq-chat-partial-label {
    display: block;
    margin-top: 8px;
    color: #8a642a;
    font-size: 14px;
}
.lq-chat-reply-note { margin: -6px 2px 0; color: #64748b; font-size: 14px; line-height: 1.5; }

.lq-chat-typing-dots { display: inline-flex; gap: 3px; }
.lq-chat-typing-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #7c9bd1;
    animation: lq-chat-bounce 1s infinite ease-in-out;
}
.lq-chat-typing-dots i:nth-child(2) { animation-delay: 0.12s; }
.lq-chat-typing-dots i:nth-child(3) { animation-delay: 0.24s; }

.lq-chat-inline-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: #aac3f3;
    text-underline-offset: 2px;
}
.lq-chat-inline-link:hover { color: #1d4ed8; text-decoration-color: currentColor; }

.lq-chat-service-card {
    align-self: stretch;
    padding: 14px;
    border: 1px solid var(--lq-chat-border);
    border-radius: 10px;
    color: #334155;
    background: #fff;
    box-shadow: 0 3px 10px rgba(51, 65, 85, 0.045);
}
.lq-chat-service-title { display: flex; align-items: center; gap: 10px; }
.lq-chat-service-title strong { color: #26354a; font-size: 18px; }
.lq-chat-service-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #b7791f;
    background: #fffbeb;
    font-size: 16px;
}
.lq-chat-service-card.unavailable .lq-chat-service-icon { color: #64748b; background: #f1f5f9; }
.lq-chat-service-card p { margin: 10px 0 13px; color: #64748b; font-size: 17px; line-height: 1.6; }
.lq-chat-service-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.lq-chat-action {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid #cfe0ff;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}
.lq-chat-action.secondary { color: #315fba; background: #fff; }
.lq-chat-action.primary { color: #fff; border-color: var(--lq-chat-blue); background: var(--lq-chat-blue); }
.lq-chat-action:hover { filter: brightness(0.98); }

.lq-chat-composer {
    flex: 0 0 auto;
    padding: 13px 14px 9px;
    border-top: 1px solid #e8eef7;
    background: #fff;
}
.lq-chat-compose-row { display: flex; align-items: flex-end; gap: 10px; }
.lq-chat-input-wrap { position: relative; min-width: 0; flex: 1; }
.lq-chat-input {
    display: block;
    width: 100%;
    min-height: 60px;
    max-height: 112px;
    box-sizing: border-box;
    resize: none;
    overflow-y: auto;
    padding: 11px 66px 23px 14px;
    border: 1px solid #dce4ee;
    border-radius: 9px;
    outline: none;
    color: #26354a;
    background: #fff;
    font-family: inherit;
    font-size: 18px;
    line-height: 1.5;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.lq-chat-input::placeholder { color: #a1acba; }
.lq-chat-input:focus { border-color: #9ebcff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.lq-chat-counter {
    position: absolute;
    right: 11px;
    bottom: 7px;
    color: #a7b0bd;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.lq-chat-counter.near-limit { color: #c78330; }
.lq-chat-send {
    display: inline-flex;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    padding: 0;
    border: 1px solid var(--lq-chat-blue);
    border-radius: 9px;
    color: #fff;
    background: var(--lq-chat-blue);
    font-size: 19px;
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease;
}
.lq-chat-send:hover:not(:disabled) { transform: translateY(-1px); }
.lq-chat-send:disabled { border-color: #c9d8f6; background: #c9d8f6; cursor: not-allowed; }
.lq-chat-send.is-stopping { font-size: 15px; font-weight: 600; background: #334155; border-color: #334155; }
.lq-chat-disclaimer { margin: 7px 0 0; color: #9aa6b5; font-size: 14px; text-align: center; }

.lq-chat-fab:focus-visible,
.lq-chat-close:focus-visible,
.lq-chat-suggestion:focus-visible,
.lq-chat-action:focus-visible,
.lq-chat-send:focus-visible,
.lq-chat-inline-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes lq-chat-pulse { 50% { opacity: 0.45; } }
@keyframes lq-chat-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }

/* 文档页移动端还有一枚右下角目录按钮，关闭状态下客服按钮移到其左侧。 */
@media (max-width: 768px) {
    body.docsify-page .lq-chat-fab { right: 80px; bottom: 18px; }
    .lq-chat-panel {
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        width: calc(100vw - 16px);
        height: 680px;
        max-height: calc(100dvh - 84px);
    }

    .lq-chat-suggestion-grid,
    .lq-chat-service-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lq-chat-fab,
    .lq-chat-send,
    .lq-chat-typing-dots i,
    .lq-chat-status-dot.connecting { animation: none; transition: none; }
}
