.assistant-root { position: fixed; right: 22px; bottom: 22px; z-index: 1500; font-family: var(--font); }
.assistant-root.raised { bottom: 92px; }
.assistant-bubble {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 50px;
    padding: 0 17px;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 25px;
    background: linear-gradient(135deg, #4cc2ff, #8b5cf6);
    color: #04101c;
    font: inherit;
    font-weight: 800;
    font-size: .84rem;
    cursor: pointer;
    box-shadow: 0 10px 32px rgba(76, 194, 255, .3), 0 4px 14px rgba(0, 0, 0, .4);
    transition: .18s;
}
.assistant-bubble:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(76, 194, 255, .4); }
.assistant-bubble-spark { font-size: 1.1rem; }
.assistant-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: min(390px, calc(100vw - 20px));
    height: min(620px, calc(100vh - 110px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: rgba(8, 14, 24, .96);
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 17px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
}
.assistant-panel.open { display: flex; }
.assistant-head { display: flex; align-items: center; gap: 9px; padding: 12px 13px; border-bottom: 1px solid var(--line-soft); background: rgba(255, 255, 255, .025); }
.assistant-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #7dd3fc, #6d28d9); color: #fff; font-size: 1rem; box-shadow: 0 0 18px rgba(76, 194, 255, .3); }
.assistant-head-info { flex: 1; min-width: 0; }
.assistant-head-info strong { display: block; color: #fff; font-size: .83rem; }
.assistant-head-info span { display: block; color: #64748b; font-size: .66rem; margin-top: 1px; }
.assistant-head-btn { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .04); color: #9fb0c6; text-decoration: none; font-size: .8rem; cursor: pointer; }
.assistant-head-btn:hover { color: #fff; background: rgba(76, 194, 255, .12); }
.assistant-messages { flex: 1; overflow-y: auto; padding: 13px; display: flex; flex-direction: column; gap: 10px; }
.assistant-welcome { text-align: center; margin: auto 0; padding: 14px 6px; }
.assistant-welcome-icon { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 17px; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #7dd3fc, #6d28d9); color: #fff; font-size: 1.35rem; box-shadow: 0 10px 30px rgba(76, 194, 255, .2); }
.assistant-welcome h3 { margin: 0 0 6px; color: #fff; font-size: 1.1rem; }
.assistant-welcome p { margin: 0 0 13px; color: #8fa4bf; font-size: .78rem; line-height: 1.55; }
.assistant-quick { display: grid; gap: 6px; }
.assistant-quick button { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .035); color: #c7d4e5; font: inherit; font-size: .76rem; text-align: left; cursor: pointer; }
.assistant-quick button:hover { border-color: rgba(76, 194, 255, .32); background: rgba(76, 194, 255, .07); color: #fff; }
.assistant-msg { display: flex; gap: 8px; max-width: 100%; }
.assistant-msg.user { flex-direction: row-reverse; }
.assistant-msg-avatar { width: 24px; height: 24px; border-radius: 8px; flex: 0 0 auto; display: grid; place-items: center; background: rgba(76, 194, 255, .13); color: #7dd3fc; font-size: .64rem; font-weight: 800; }
.assistant-msg.user .assistant-msg-avatar { background: rgba(168, 85, 247, .15); color: #e9d5ff; }
.assistant-msg-body { max-width: 84%; display: flex; flex-direction: column; gap: 4px; }
.assistant-msg.user .assistant-msg-body { align-items: flex-end; }
.assistant-msg-content { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .035); color: #dbe6f5; font-size: .79rem; line-height: 1.55; overflow-wrap: anywhere; }
.assistant-msg.user .assistant-msg-content { background: rgba(76, 194, 255, .1); border-color: rgba(76, 194, 255, .18); }
.assistant-msg-content p { margin: 0 0 6px; }
.assistant-msg-content p:last-child { margin: 0; }
.assistant-msg-content code { background: rgba(255, 255, 255, .08); border-radius: 4px; padding: 1px 4px; font-size: .88em; color: #bae6fd; }
.assistant-msg-content pre { margin: 6px 0; padding: 8px; border-radius: 7px; background: #040910; border: 1px solid var(--line-soft); overflow-x: auto; white-space: pre-wrap; }
.assistant-msg-content pre code { background: transparent; padding: 0; }
.assistant-msg-content a { color: #7dd3fc; }
.assistant-action { align-self: flex-start; padding: 5px 9px; border: 1px solid rgba(76, 194, 255, .28); border-radius: 7px; background: rgba(76, 194, 255, .08); color: #bae6fd; font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; }
.assistant-action:hover { background: rgba(76, 194, 255, .17); }
.assistant-thinking { color: #8fa4bf; font-size: .76rem; }
.assistant-compose { display: flex; align-items: flex-end; gap: 7px; padding: 9px; border-top: 1px solid var(--line-soft); background: rgba(4, 9, 17, .45); }
.assistant-compose textarea { flex: 1; min-height: 34px; max-height: 110px; resize: none; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(4, 9, 17, .65); color: #e5edf9; font: inherit; font-size: .8rem; outline: none; }
.assistant-compose textarea:focus { border-color: rgba(76, 194, 255, .45); }
.assistant-send { width: 34px; height: 34px; border: none; border-radius: 9px; background: linear-gradient(135deg, #4cc2ff, #3a9bd5); color: #03131f; font-size: 1rem; cursor: pointer; flex: 0 0 auto; }
.assistant-send.hidden { display: none; }
.assistant-stop { background: rgba(248, 113, 113, .2); color: #fecaca; }
.assistant-login { padding: 28px 20px; text-align: center; color: #8fa4bf; font-size: .84rem; line-height: 1.6; }
.assistant-login .btn { margin-top: 8px; }
.assistant-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(2, 6, 12, .7); backdrop-filter: blur(5px); z-index: 2000; padding: 16px; }
.assistant-modal.open { display: flex; }
.assistant-modal-card { width: min(430px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(10, 16, 27, .98); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); text-align: center; }
.assistant-modal-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 13px; display: grid; place-items: center; background: rgba(76, 194, 255, .12); font-size: 1.2rem; }
.assistant-modal-card h3 { margin: 0 0 7px; color: #fff; font-size: 1rem; }
.assistant-modal-card p { margin: 0 0 12px; color: #8fa4bf; font-size: .8rem; line-height: 1.5; }
.assistant-ticket-preview { display: grid; gap: 5px; padding: 10px; margin-bottom: 14px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(4, 9, 17, .65); text-align: left; }
.assistant-ticket-preview strong { color: #e5edf9; font-size: .8rem; }
.assistant-ticket-preview span { color: #8fa4bf; font-size: .74rem; line-height: 1.45; max-height: 100px; overflow: auto; }
.assistant-modal-actions { display: flex; gap: 8px; }
.assistant-modal-actions .btn { flex: 1; }
@media (max-width: 640px) {
    .assistant-root { right: 12px; bottom: 12px; }
    .assistant-root.raised { bottom: 82px; }
    .assistant-bubble { height: 44px; padding: 0 14px; }
    .assistant-panel { position: fixed; right: 8px; left: 8px; bottom: 66px; width: auto; height: min(68vh, 560px); }
}

/* Улучшенные z-index и перетаскивание */
.assistant-root { z-index: 1600; touch-action: none; }
.assistant-bubble { cursor: move; user-select: none; }
.assistant-modal { z-index: 5000; }

/* ── Индивидуальное положение AI-кнопки на разных страницах ── */
body.page-chat .assistant-root { right: 16px; bottom: 88px; }
body.page-chat .assistant-bubble { height: 42px; padding: 0 13px; }
body.page-pages_run .assistant-root,
body.page-dozit_server .assistant-root,
body.page-dozit_index .assistant-root { right: auto; left: 16px; bottom: 16px; }
body.page-promptly .assistant-root { right: 340px; bottom: 20px; }
body.page-promptly .assistant-bubble { height: 42px; padding: 0 13px; }
@media (max-width: 1200px) {
    body.page-promptly .assistant-root { right: 16px; bottom: 16px; }
}
@media (max-width: 900px) {
    body.page-chat .assistant-root { right: auto; left: 12px; bottom: 80px; }
    body.page-pages_run .assistant-root, body.page-dozit_server .assistant-root,
    body.page-dozit_index .assistant-root { left: 12px; bottom: 12px; }
}
