.ai-assistant {
    --ai-navy: #132b3a;
    --ai-blue: #1591aa;
    --ai-line: #cfdee4;
    --ai-ink: #264653;
    --ai-muted: #718690;
    position: fixed;
    z-index: 12000;
    right: 22px;
    bottom: 104px;
    font-family: inherit;
}

/* 小程序码展开时将 AI 入口移到卡片左侧，两个浮层各自保持完整点击区域。 */
.mini-program-promo--open:not(.mini-program-promo--dismissed) ~ .ai-assistant {
    right: 338px;
    bottom: 22px;
}

.ai-assistant button,
.ai-assistant textarea,
.ai-assistant select { font: inherit; }

.ai-assistant__launcher {
    min-width: 252px;
    min-height: 68px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    color: #fff;
    border: 1px solid rgba(134, 224, 231, .5);
    border-radius: 16px;
    background: #0f6f80;
    box-shadow: 0 15px 38px rgba(8, 35, 48, .34), inset 0 1px 0 rgba(255, 255, 255, .14);
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: transform .18s cubic-bezier(.16, 1, .3, 1), border-color .18s ease, box-shadow .18s ease;
    animation: ai-launcher-intro .55s cubic-bezier(.16, 1, .3, 1) both;
}

.ai-assistant__launcher:visited { color: #fff; }

.ai-assistant__launcher:hover { transform: translateY(-2px); border-color: rgba(178, 240, 244, .85); box-shadow: 0 19px 44px rgba(8, 35, 48, .4), inset 0 1px 0 rgba(255, 255, 255, .18); }
.ai-assistant__launcher:active { transform: scale(.98); }
.ai-assistant__launcher:focus-visible { outline: 3px solid #76d7e2; outline-offset: 3px; }
.ai-assistant__launcher-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .18); border-radius: 11px; background: rgba(255, 255, 255, .13); font-size: 18px; }
.ai-assistant__launcher-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; line-height: 1.15; }
.ai-assistant__launcher strong { font-size: 15px; font-weight: 750; letter-spacing: .01em; white-space: nowrap; }
.ai-assistant__launcher small { color: #c9e9ed; font-size: 11px; white-space: nowrap; }
.ai-assistant__launcher-action { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; color: #0a5060; border-radius: 999px; background: #dff5f7; font-size: 11px; font-weight: 800; white-space: nowrap; }
.ai-assistant__launcher-action i { font-size: 9px; }
@keyframes ai-launcher-intro { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.tech-navbar .ai-navbar-entry {
    display: inline-flex;
    align-items: center;
    margin: 0 5px 0 0;
    padding: 7px 11px !important;
    color: #fff !important;
    border: 1px solid rgba(115, 221, 229, .52);
    border-radius: 9px;
    background: #126f80;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background-color .16s ease;
}
.tech-navbar .ai-navbar-entry::before { display: none; }
.tech-navbar .ai-navbar-entry:hover { color: #fff !important; border-color: #9ee4e9; background: #0e6271; transform: translateY(-1px); }
.tech-navbar .ai-navbar-entry:active { transform: scale(.98); }
.tech-navbar .ai-navbar-entry:focus-visible { outline: 2px solid #7edce4; outline-offset: 2px; }

.ai-sidebar-entry {
    gap: 10px;
    margin-top: 7px;
    color: #ecfeff;
    border: 1px solid rgba(86, 211, 220, .36);
    background: rgba(18, 126, 143, .28);
    text-align: left;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background-color .16s ease;
}
.ai-sidebar-entry:hover { border-color: rgba(125, 229, 235, .66); background: rgba(18, 126, 143, .4); transform: translateY(-1px); }
.ai-sidebar-entry:active { transform: scale(.98); }
.ai-sidebar-entry:focus-visible { outline: 2px solid #6ed7df; outline-offset: 2px; }
.ai-sidebar-entry .sidebar-nav-icon { color: #66d6df; }
.ai-sidebar-entry__badge { margin-left: auto; padding: 2px 6px; color: #083b46; border-radius: 999px; background: #9de7eb; font-size: 10px; font-weight: 850; letter-spacing: .04em; }

.ai-assistant__backdrop { position: fixed; z-index: 0; inset: 0; background: rgba(6, 22, 31, .35); }
.ai-assistant__panel {
    position: fixed;
    z-index: 1;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(760px, calc(100vw - 24px));
    display: grid;
    grid-template-rows: 60px minmax(0, 1fr) auto;
    color: var(--ai-ink);
    border: 1px solid #d4e0e4;
    border-radius: 14px;
    background: #f6f9fa;
    box-shadow: 0 18px 54px rgba(7, 28, 38, .24);
    overflow: hidden;
    animation: ai-panel-in .22s ease-out;
}

.ai-assistant__panel[hidden], .ai-assistant__backdrop[hidden] { display: none; }
@keyframes ai-panel-in { from { opacity: .6; transform: translateX(35px); } to { opacity: 1; transform: translateX(0); } }

.ai-assistant__header { display: grid; grid-template-columns: 36px 1fr auto 34px; gap: 10px; align-items: center; padding: 0 14px 0 18px; border-bottom: 1px solid var(--ai-line); background: #fff; }
.ai-assistant__brand { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; border-radius: 9px; background: var(--ai-blue); }
.ai-assistant__header h2 { margin: 0; color: #173f4e; font-size: 18px; line-height: 1.1; }
.ai-assistant__quota { padding: 5px 9px; color: #315966; border-radius: 999px; background: #eaf3f5; font-size: 12px; white-space: nowrap; }
.ai-assistant__close { width: 34px; height: 34px; color: #617982; border: 0; border-radius: 8px; background: transparent; font-size: 27px; line-height: 1; cursor: pointer; }
.ai-assistant__close:hover { color: #173f4e; background: #edf3f5; }

.ai-assistant__messages { min-height: 0; padding: 20px 22px; overflow-y: auto; scrollbar-width: thin; }
.ai-assistant__welcome { padding: 12px 14px; color: var(--ai-muted); border: 1px solid #dbe5e8; border-radius: 9px; background: #fff; text-align: center; }
.ai-assistant__welcome[hidden] { display: none; }
.ai-assistant__welcome strong { font-size: 13px; font-weight: 500; }
.ai-assistant__message { display: flex; gap: 8px; margin: 14px 0; }
.ai-assistant__message--user { justify-content: flex-end; }
.ai-assistant__message-avatar { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: var(--ai-blue); }
.ai-assistant__message-body { max-width: 78%; }
.ai-assistant__message--assistant .ai-assistant__message-body { max-width: calc(100% - 36px); }
.ai-assistant__message-body small { display: block; margin: 0 3px 4px; color: #81939b; font-size: 10px; }
.ai-assistant__message--user .ai-assistant__message-body small { text-align: right; }
.ai-assistant__message-text { margin: 0; padding: 11px 13px; color: #203f4b; border: 1px solid #d5e0e4; border-radius: 4px 12px 12px 12px; background: #fff; font-size: 14px; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-assistant__message-text p { margin: 0 0 8px; }
.ai-assistant__message-text p:last-child { margin-bottom: 0; }
.ai-assistant__message-text h3 { margin: 12px 0 5px; color: #173f4e; font-size: 13px; line-height: 1.4; }
.ai-assistant__message-text h3:first-child { margin-top: 0; }
.ai-assistant__message-text ul,
.ai-assistant__message-text ol { margin: 4px 0 8px; padding-left: 20px; white-space: normal; }
.ai-assistant__message-text li + li { margin-top: 4px; }
.ai-assistant__message-text strong { color: #234956; font-weight: 700; }
.ai-assistant__table-wrap { max-width: 100%; margin: 9px 0 11px; overflow-x: auto; border: 1px solid #bdcfd5; border-radius: 8px; background: #fff; white-space: normal; }
.ai-assistant .ai-assistant__message-text .ai-assistant__table-wrap table { --bs-table-bg: #fff !important; --bs-table-color: #203f4b !important; width: max-content; min-width: 100%; border-collapse: collapse; color: #203f4b !important; background: #fff !important; font-size: 14px; line-height: 1.55; }
.ai-assistant__table-wrap th,
.ai-assistant__table-wrap td { --bs-table-bg: #fff !important; --bs-table-color: #183946 !important; padding: 9px 11px; border-right: 1px solid #cedde1 !important; border-bottom: 1px solid #cedde1 !important; color: #183946 !important; background: #fff !important; text-align: left; vertical-align: top; white-space: nowrap; }
.ai-assistant .ai-assistant__message-text .ai-assistant__table-wrap thead,
.ai-assistant .ai-assistant__message-text .ai-assistant__table-wrap th { --bs-table-bg: #d9e9ed !important; --bs-table-color: #102f3a !important; color: #102f3a !important; background: #d9e9ed !important; font-weight: 700; }
.ai-assistant__table-wrap th:last-child,
.ai-assistant__table-wrap td:last-child { border-right: 0; }
.ai-assistant__table-wrap tbody tr:last-child td { border-bottom: 0; }
.ai-assistant .ai-assistant__message-text .ai-assistant__table-wrap tbody tr:nth-child(even) td { --bs-table-bg: #f0f5f6 !important; color: #183946 !important; background: #f0f5f6 !important; }
.ai-assistant .ai-assistant__message-text .ai-assistant__table-wrap tbody tr:hover td { --bs-table-bg: #e3f0f3 !important; color: #173f4e !important; background: #e3f0f3 !important; }
.ai-assistant__message--user .ai-assistant__message-text { color: #fff; border-color: #177b92; border-radius: 12px 4px 12px 12px; background: #177b92; }
.ai-assistant__message-text[data-thinking="true"] { color: #82969f; }
.ai-assistant__continue { margin-top: 6px; padding: 5px 9px; color: #126f86; border: 1px solid #8ec5d0; border-radius: 7px; background: #f3fbfc; font-size: 11px; cursor: pointer; transition: color .15s ease, border-color .15s ease, background-color .15s ease, transform .15s ease; }
.ai-assistant__continue:hover { color: #0d5b6d; border-color: #4b9caf; background: #e8f7f9; }
.ai-assistant__continue:active { transform: scale(.98); }
.ai-assistant__continue:focus-visible { outline: 2px solid #167f98; outline-offset: 2px; }

.ai-assistant__composer-area { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 16px 14px; border-top: 1px solid var(--ai-line); background: #fff; }
.ai-assistant__error { grid-column: 1 / -1; padding: 8px 10px; color: #8e3828; border-left: 3px solid #ce6147; background: #fff0eb; font-size: 12px; }
.ai-assistant__error[hidden] { display: none; }
.ai-assistant__tools { display: flex; align-items: center; gap: 7px; color: #667d86; font-size: 12px; }
.ai-assistant__quota-policy { margin-right: auto; color: #718690; white-space: nowrap; }
.ai-assistant__tools label { white-space: nowrap; }
.ai-assistant__tools select { height: 36px; padding: 4px 26px 4px 8px; color: #405b65; border: 1px solid #c8d7dc; border-radius: 7px; background: #fff; }
.ai-assistant__tools button { height: 36px; padding: 4px 8px; color: #667d86; border: 0; border-radius: 7px; background: transparent; cursor: pointer; white-space: nowrap; }
.ai-assistant__tools button:hover { color: #294a58; background: #edf3f5; }
.ai-assistant__prompt-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.ai-assistant__prompt-bar label { display: inline-flex; align-items: center; gap: 5px; color: #315966; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ai-assistant__prompt-bar select { width: 100%; min-width: 0; height: 34px; padding: 4px 28px 4px 9px; color: #31515e; border: 1px solid #b9cfd6; border-radius: 6px; background: #fff; font-size: 12px; cursor: pointer; }
.ai-assistant__prompt-bar select:hover { border-color: #6eabb9; }
.ai-assistant__prompt-bar select:focus-visible { outline: 2px solid #167f98; outline-offset: 2px; }
.ai-assistant__composer { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 8px; border: 1px solid #aebfc5; border-radius: 9px; background: #fbfdfd; }
.ai-assistant__composer:focus-within { border-color: #388fa5; box-shadow: 0 0 0 2px rgba(39, 142, 166, .1); }
.ai-assistant__composer textarea { width: 100%; min-height: 44px; max-height: 120px; padding: 3px; resize: vertical; color: #294a58; border: 0; outline: 0; background: transparent; font-size: 13px; line-height: 1.5; }
#ai-assistant-root .ai-assistant__prompt-bar select,
#ai-assistant-root .ai-assistant__tools select {
    color: #294a58 !important;
    border-color: #b9cbd1 !important;
    background: #fff !important;
    color-scheme: light;
}
#ai-assistant-root .ai-assistant__prompt-bar select option,
#ai-assistant-root .ai-assistant__tools select option {
    color: #294a58;
    background: #fff;
}
#ai-assistant-root .ai-assistant__composer textarea {
    color: #203f4b !important;
    background: transparent !important;
    -webkit-text-fill-color: #203f4b;
}
#ai-assistant-root .ai-assistant__composer textarea::placeholder {
    color: #7d9098 !important;
    opacity: 1;
    -webkit-text-fill-color: #7d9098;
}
.ai-assistant__send, .ai-assistant__stop { min-width: 66px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #fff; border: 0; border-radius: 7px; background: var(--ai-blue); cursor: pointer; }
.ai-assistant__stop { background: #b65b47; }
.ai-assistant__send:disabled { opacity: .45; cursor: not-allowed; }
.ai-assistant__privacy { margin: 0 0 7px; color: #6f8393; font-size: 11px; line-height: 1.35; }
@media (max-width: 640px) {
    .ai-assistant { right: 12px; bottom: 92px; }
    .mini-program-promo--open:not(.mini-program-promo--dismissed) ~ .ai-assistant {
        right: 12px;
        bottom: 312px;
    }
    .ai-assistant__launcher { min-width: 192px; min-height: 58px; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; padding: 8px 10px; }
    .ai-assistant__launcher-icon { width: 36px; height: 36px; border-radius: 9px; font-size: 16px; }
    .ai-assistant__launcher strong { font-size: 13px; }
    .ai-assistant__launcher small { font-size: 10px; }
    .ai-assistant__launcher-action { display: none; }
    .ai-assistant__panel { inset: 0; width: 100vw; border: 0; border-radius: 0; }
    .ai-assistant__header { grid-template-columns: 34px 1fr auto 34px; padding-left: 12px; }
    .ai-assistant__brand { width: 34px; height: 34px; }
    .ai-assistant__messages { padding: 14px 12px; }
    .ai-assistant__composer-area { grid-template-columns: 1fr; padding: 10px 12px 12px; }
    .ai-assistant__prompt-bar { grid-template-columns: 1fr; gap: 5px; }
    .ai-assistant__tools { justify-content: flex-end; flex-wrap: wrap; }
    .ai-assistant__quota-policy { width: 100%; margin-right: 0; }
    .ai-assistant__tools label { margin-right: auto; }
    .ai-assistant__message-body { max-width: 88%; }
}

@media (max-width: 420px) {
    .ai-assistant__quota { padding: 4px 7px; font-size: 11px; }
    .ai-assistant__header h2 { font-size: 16px; }
    .ai-assistant__tools label { display: none; }
    .ai-assistant__tools select { margin-right: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .ai-assistant__panel { animation: none; }
    .ai-assistant__launcher { animation: none; }
    .ai-assistant button,
    .ai-navbar-entry,
    .ai-sidebar-entry { transition: none; }
}
