/* Лиза — локальный ИИ-помощник. Виден только супер-админу. */
/* Боковой «нарост»: не занимает центр экрана и не открывает чат сам. */
#lizaFab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99980;
    width: 46px;
    height: 64px;
    min-width: 0;
    padding: 0;
    border-radius: 16px 0 0 16px;
    border: 1px solid rgba(122, 92, 255, .55);
    border-right: 0;
    background: linear-gradient(135deg, #5b4bff, #9a6bff);
    color: #fff;
    font: 700 16px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: 0 10px 30px rgba(80, 60, 220, .38);
    cursor: grab;
    touch-action: none;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    user-select: none;
}
#lizaFab:active { cursor: grabbing; }
#lizaFab .liza-tab-letter { font-size: 16px; font-weight: 800; line-height: 1; }
#lizaFab .liza-tab-grip {
    width: 13px; height: 2px; border-radius: 2px;
    background: rgba(255,255,255,.55);
    box-shadow: 0 4px 0 rgba(255,255,255,.35);
}
#lizaFab:hover { filter: brightness(1.08); }
#lizaFab .liza-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #8a93a6;
    box-shadow: 0 0 0 4px rgba(138,147,166,.10);
}
#lizaFab.active .liza-dot { background: #6dffb0; box-shadow: 0 0 0 4px rgba(109,255,176,.18); animation: lizaDotPulse 1.5s infinite; }
#lizaFab.command .liza-dot { background: #ff506b; box-shadow: 0 0 0 4px rgba(255,80,107,.20); animation: lizaPulse 1s infinite; }
@keyframes lizaDotPulse { 50% { box-shadow: 0 0 0 8px rgba(109,255,176,.06); } }
.liza-voice-hint {
    padding: 5px 14px 7px; font-size: 10.5px; color: #8fa0b5;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.liza-voice-hint.ok { color: #79e7ae; }
.liza-voice-hint.err { color: #ff9b9b; }
.liza-voice-hint.listen { color: #ffd18a; }
#lizaToast {
    position: fixed; left: 50%; top: 76px; transform: translateX(-50%);
    z-index: 100000; max-width: 90vw; padding: 10px 16px; border-radius: 999px;
    background: rgba(20, 27, 42, .96); border: 1px solid rgba(122,92,255,.55);
    color: #f2f5fb; font: 600 13px/1.3 system-ui, sans-serif;
    box-shadow: 0 12px 34px rgba(0,0,0,.5); display: none; text-align: center;
}
#lizaToast.show { display: block; animation: lizaToastIn .18s ease-out; }
@keyframes lizaToastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

#lizaPanel {
    position: fixed;
    right: 16px;
    bottom: 148px;
    z-index: 99990;
    width: min(430px, calc(100vw - 24px));
    max-height: min(680px, calc(100vh - 180px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(122, 92, 255, .38);
    background: rgba(15, 20, 31, .97);
    color: var(--text-primary, #e7ecf5);
    box-shadow: 0 24px 80px rgba(0,0,0,.55);
    backdrop-filter: blur(14px);
}
#lizaPanel.open { display: flex; }
.liza-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(135deg, rgba(91,75,255,.22), rgba(154,107,255,.08));
}
.liza-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.liza-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; font-size: 15px;
    background: linear-gradient(135deg, #6c5cff, #c18bff);
    box-shadow: 0 0 0 3px rgba(120,90,255,.16);
}
.liza-sub { font-size: 10px; color: #98a6bb; font-weight: 400; margin-top: 2px; }
.liza-head-actions { display:flex; align-items:center; gap:2px; }
.liza-head button {
    border: 0; background: transparent; color: #aeb9ca; font-size: 20px; cursor: pointer;
    padding: 2px 6px; border-radius: 8px;
}
.liza-head button:hover { background: rgba(255,255,255,.08); color: #fff; }
.liza-messages {
    flex: 1; overflow-y: auto; padding: 13px; display: flex; flex-direction: column; gap: 9px;
    min-height: 120px;
}
.liza-msg {
    max-width: 90%; padding: 9px 11px; border-radius: 13px; font-size: 12.5px; line-height: 1.45;
    white-space: pre-wrap; word-break: break-word;
}
.liza-msg.user { align-self: flex-end; background: #4d5cff; color: #fff; border-bottom-right-radius: 4px; }
.liza-msg.bot { align-self: flex-start; background: rgba(255,255,255,.075); border: 1px solid rgba(255,255,255,.06); border-bottom-left-radius: 4px; }
.liza-msg.sys { align-self: center; max-width: 100%; background: rgba(255,183,77,.10); border: 1px solid rgba(255,183,77,.24); color: #ffd18a; font-size: 11px; }
.liza-typing { color: #9aa7ba; font-size: 11px; padding: 2px 4px; }
.liza-action {
    margin-top: 7px; padding: 9px; border-radius: 10px; background: rgba(255,255,255,.05);
    border: 1px solid rgba(130,105,255,.34);
}
.liza-action-title { font-size: 11px; color: #c9bfff; font-weight: 700; margin-bottom: 3px; }
.liza-action-text { font-size: 11.5px; color: #dce4ef; line-height: 1.4; }
.liza-action-btns { display: flex; gap: 6px; margin-top: 7px; }
.liza-action-btns button { flex: 1; padding: 6px 8px; border-radius: 7px; font-size: 11px; cursor: pointer; border: 1px solid rgba(255,255,255,.12); }
.liza-action-go { background: #5b4bff; color: #fff; border-color: transparent !important; }
.liza-action-cancel { background: transparent; color: #aab5c5; }
.liza-sources { font-size: 10px; color: #8796ab; padding: 5px 13px 0; line-height: 1.4; }
.liza-input-row {
    display: flex; gap: 7px; padding: 10px 12px 12px; border-top: 1px solid rgba(255,255,255,.08);
    align-items: flex-end;
}
#lizaInput {
    flex: 1; min-height: 38px; max-height: 100px; resize: none; padding: 10px 11px;
    border-radius: 10px; border: 1px solid rgba(255,255,255,.11); background: rgba(255,255,255,.06);
    color: #eef3fb; font: 12.5px/1.35 system-ui, sans-serif; outline: none;
}
#lizaInput:focus { border-color: rgba(130,105,255,.65); }
.liza-mic, .liza-send {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.13);
    background: rgba(255,255,255,.06); color: #dfe7f2; cursor: pointer; font-size: 16px;
}
.liza-mic.listening { background: #ff506b; border-color: transparent; animation: lizaPulse 1s infinite; }
.liza-send { background: #5b4bff; border-color: transparent; color: #fff; }
.liza-chips { display: flex; gap: 5px; overflow-x: auto; padding: 0 12px 9px; scrollbar-width: none; }
.liza-chips::-webkit-scrollbar { display: none; }
.liza-chip {
    flex: 0 0 auto; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.045);
    color: #b9c5d6; border-radius: 999px; padding: 5px 9px; font-size: 10.5px; cursor: pointer;
}
.liza-chip:hover { color: #fff; border-color: rgba(130,105,255,.55); }
@keyframes lizaPulse { 50% { box-shadow: 0 0 0 8px rgba(255,80,107,.16); } }
@media (max-width: 900px) {
    /* Боковой «нарост» справа, над календарной шторкой. */
    #lizaFab {
        top: auto;
        bottom: calc(42vh + 20px);
        right: 0;
        transform: none;
        width: 42px;
        height: 56px;
        border-radius: 14px 0 0 14px;
    }
    #lizaPanel { right: 8px; bottom: calc(42vh + 66px); width: calc(100vw - 16px); max-height: calc(58vh - 76px); }
}
@media (max-width: 400px) {
    #lizaFab { width: 38px; height: 52px; font-size: 14px; }
}
/* Источники не показываем в чате: они нужны для отладки, не для диалога. */
#lizaSources { display: none !important; }
