
    /* ===== RESET & BASE ===== */
    *,
    *::before,
    *::after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        min-width: 0;
    }

    html {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    *,
    *:before,
    *:after {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    img,
    svg,
    video,
    canvas,
    audio,
    iframe,
    embed,
    object {
        display: block;
        max-width: 100%;
        height: auto;
    }

    input,
    button,
    textarea,
    select {
        font: inherit;
        color: inherit;
        background: none;
        border: none;
        outline: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    input,
    textarea {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }

    button {
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }

    a {
        text-decoration: none;
        color: inherit;
        -webkit-touch-callout: none;
    }

    ul,
    ol {
        list-style: none;
    }

    table {
        border-collapse: collapse;
        border-spacing: 0;
    }

    blockquote,
    q {
        quotes: none;
    }

    blockquote::before,
    blockquote::after,
    q::before,
    q::after {
        content: '';
    }

    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 10px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    * {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    }

    *:focus-visible {
        outline: 2px solid rgba(62, 255, 110, 0.4);
        outline-offset: 2px;
    }

    :focus:not(:focus-visible) {
        outline: none;
    }

    .no-select {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    article,
    aside,
    details,
    figcaption,
    figure,
    footer,
    header,
    hgroup,
    menu,
    nav,
    section {
        display: block;
    }

    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background: #050505;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        -webkit-tap-highlight-color: transparent;
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        overscroll-behavior: none;
    }

    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
        min-height: 100vh;
        min-height: 100dvh;
        background: #050505;
        display: flex;
        color: #e0e0e0;
    }

    /* ===== ROOT VARIABLES (Neon Theme) ===== */
:root {
    /* Акцентный неон — для выбранных и активных элементов */
    --neon-primary: #35d96b;
    --neon-secondary: #a6efb5;
    --neon-glow: rgba(53, 217, 107, 0.08);
    --neon-glow-strong: rgba(53, 217, 107, 0.18);

    /* Тёмные поверхности */
    --bg-primary: #0b100d;
    --bg-secondary: #101712;
    --bg-hover: #1b2920;
    --bg-surface: #151e17;

    /* Границы */
    --border-neon: 1px solid rgba(120, 210, 140, 0.10);
    --border-neon-active: 1px solid rgba(80, 220, 120, 0.35);
    --border-light: 1px solid rgba(255, 255, 255, 0.06);

    /* Текст */
    --text-primary: #e7eee8;
    --text-secondary: #a2b2a4;
    --text-muted: #667568;
    --text-hint: #77877a;

    /* Размеры интерфейса */
    --sidebar-width: 280px;
    --sidebar-collapsed: 68px;
    --header-height: 48px;
    --input-height: 48px;
    --footer-height: 28px;

    /* Скругления */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Типографика и анимации */
    --haya-font-size: 16px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

    /* ===== ГЛОБАЛЬНОЕ ПРИМЕНЕНИЕ РАЗМЕРА ШРИФТА ===== */
    .message,
    .message .nickname-label,
    .message .timestamp,
    .message .message-body,
    #messageInput,
    .chat-item .chat-name,
    .profile-name,
    .profile-status,
    .sidebar-brand-text,
    .auth-title,
    .auth-subtitle,
    .modal-title,
    .modal-tab,
    .modal-form-group label,
    .modal-form-group input,
    .modal-form-group textarea,
    .auth-input,
    .auth-btn,
    .auth-toggle,
    .sidebar-search-input,
    .header-left .chat-title,
    #statusText {
        font-size: var(--haya-font-size);
    }

    /* ===== AUTH OVERLAY ===== */
    .auth-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.94);display:none;justify-content:center;align-items:center;z-index:1000;backdrop-filter:blur(16px)}
    .auth-overlay.active{display:flex}

    .auth-box{background:var(--bg-secondary);border:var(--border-neon);border-radius:var(--radius-xl);padding:40px;width:100%;max-width:380px;box-shadow:var(--neon-glow), 0 0 80px rgba(0,255,100,0.03);text-align:center;backdrop-filter:blur(20px)}
    .auth-logo{font-size:52px;margin-bottom:8px;display:block;filter:drop-shadow(0 0 30px rgba(62,255,110,0.2))}
    .auth-title{font-size:1.6rem;font-weight:600;color:var(--text-primary);margin-bottom:4px;letter-spacing:-0.02em;background:linear-gradient(135deg, var(--neon-secondary), var(--neon-primary));-webkit-background-clip:text;-webkit-text-fill-color:transparent}
    .auth-subtitle{font-size:.8rem;color:var(--text-secondary);margin-bottom:24px;font-weight:400}
    
    .auth-input{width:100%;background:var(--bg-primary);border:var(--border-neon);border-radius:var(--radius-md);padding:12px 16px;color:var(--text-primary);font-size:.95rem;outline:none;transition:all var(--transition);margin-bottom:10px}
    .auth-input:focus{border-color:var(--neon-primary);box-shadow:0 0 30px var(--neon-glow)}
    .auth-input::placeholder{color:var(--text-hint)}
    
    .auth-btn{width:100%;background:linear-gradient(135deg, #1f3a1f, #2a4a2a);border:var(--border-neon);color:var(--text-primary);padding:12px;border-radius:var(--radius-md);font-size:.95rem;font-weight:600;cursor:pointer;transition:all var(--transition);margin-top:4px}
    .auth-btn:hover{background:var(--neon-primary);color:#0b150b;border-color:var(--neon-secondary);box-shadow:0 0 50px rgba(0,255,100,0.2)}
    .auth-btn:active{transform:scale(.97)}
    .auth-btn:disabled{opacity:.4;cursor:not-allowed}
    
    .auth-error{color:#ff6b6b;font-size:.8rem;margin-top:10px;min-height:20px}
    .auth-success{color:var(--neon-primary);font-size:.8rem;margin-top:10px;min-height:20px}
    
    .auth-toggle{color:var(--text-hint);font-size:.8rem;margin-top:14px;cursor:pointer;transition:all var(--transition)}
    .auth-toggle:hover{color:var(--text-secondary)}
    .auth-toggle span{color:var(--neon-primary);font-weight:500}
    
    .auth-password-container{position:relative;width:100%}
    .auth-password-toggle{position:absolute;right:12px;top:50%;transform:translateY(-50%);background:none;border:none;color:var(--text-hint);cursor:pointer;font-size:1rem;padding:4px 8px;transition:var(--transition)}
    .auth-password-toggle:hover{color:var(--text-secondary)}
    

    /* ===== ПЛАТФОРМА — ПРЕМИАЛЬНЫЙ БЛОК ===== */
.auth-platform-info {
    display: flex;
    align-items: center;gap: 12px;
    padding: 10px 14px;margin-bottom: 20px;
    background: rgba(62, 255, 110, 0.02);border: 1px solid rgba(62, 255, 110, 0.04);
    border-radius: 12px; transition: all 0.3s ease;
}

.auth-platform-info:hover {
    background: rgba(62, 255, 110, 0.04);
    border-color: rgba(62, 255, 110, 0.08);
}

.platform-badge {
    font-size: 1.2rem;
    flex-shrink: 0;
    opacity: 0.5;
}

.platform-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.platform-title {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.platform-desc {
    font-size: 14px;
    color: #ffffff;
    letter-spacing: 0.3px;
    opacity: 0.7;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 480px) {
    .auth-platform-info {
        padding: 8px 12px;
        gap: 10px;
    }
    .platform-badge {
        font-size: 1rem;
    }
    .platform-title {
        font-size: 0.6rem;
    }
    .platform-desc {
        font-size: 0.5rem;
    }
}

    /* ===== APP ===== */
    .app {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        background: var(--bg-primary);
        display: none;
        flex-direction: column;
        overflow: hidden;
        border: var(--border-light);
        position: relative;
    }
    .app.active{display:flex}

    /* ===== HEADER — плавное скрытие ===== */
    .header {
        padding: 6px 14px;
        background: var(--bg-secondary);
        border-bottom: var(--border-light);
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
        gap: 8px;
        height: var(--header-height);
        min-height: var(--header-height);
        max-height: var(--header-height);
        transition: 
            margin-top 0.25s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.2s ease,
            transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 20;
        position: relative;
    }

    /* 👇 Скрытое состояние — уезжает вверх */
    .header.hidden {
        margin-top: calc(var(--header-height) * -1);
        opacity: 0;
        transform: translateY(-100%);
        pointer-events: none;
    }

    .header-left{display:flex;align-items:center;gap:8px;min-width:0}
    .sidebar-toggle {
        display:none;
        background:transparent;
        border:var(--border-light);
        border-radius:var(--radius-sm);
        color:var(--text-secondary);
        padding:4px 8px;
        cursor:pointer;
        font-size:1.1rem;
        transition:var(--transition);
    }
    .sidebar-toggle:hover { background:var(--bg-hover); color:var(--text-primary); }
    .header-left .chat-title {
        font-weight:500;
        color:var(--text-primary);
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        font-size: var(--haya-font-size);
    }
    .header-left .chat-type-badge { 
        font-size:.5rem; 
        background:var(--bg-primary); 
        padding:2px 8px; 
        border-radius:10px; 
        color:var(--text-hint); 
        flex-shrink:0; 
        border:var(--border-light);
        text-transform:uppercase;
        letter-spacing:0.5px;
    }
    .status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex-shrink:0}
    .status-dot.online{background:var(--neon-primary);box-shadow:0 0 16px var(--neon-glow-strong)}
    .status-dot.offline{background:#4f4f4f}
    .status-dot.connecting{background:#ffbf3f;box-shadow:0 0 16px rgba(255,191,63,0.3);animation:pulse 1s infinite}
    @keyframes pulse{0%,100%{opacity:1}50%{opacity:.3}}
    .header-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
    #statusText{
        color:var(--text-hint);
        white-space:nowrap;
        font-size: var(--haya-font-size);
    }

    /* ===== APP CONTENT ===== */
    .app-content {
        display: flex;
        flex: 1;
        overflow: hidden;
        min-height: 0;
        height: auto;
        transition: margin-top 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* ===== CHAT SIDEBAR ===== */
    .chat-sidebar {
        width: var(--sidebar-width);
        background: var(--bg-secondary);
        border-right: var(--border-light);
        overflow-y: auto;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        transition: width var(--transition);
        position: relative;
        height: 100%;
    }

    .chat-sidebar.collapsed {
        width: var(--sidebar-collapsed);
    }

    .chat-sidebar.collapsed .chat-name,
    .chat-sidebar.collapsed .chat-badge,
    .chat-sidebar.collapsed .list-section-title,
    .chat-sidebar.collapsed .sidebar-profile .profile-label,
    .chat-sidebar.collapsed .profile-info,
    .chat-sidebar.collapsed .profile-actions,
    .chat-sidebar.collapsed .sidebar-brand-text,
    .chat-sidebar.collapsed .sidebar-search-input {
        opacity: 0;
        width: 0;
        overflow: hidden;
        display: none !important;
    }

    .chat-sidebar.collapsed .chat-item {
        justify-content: center;
        padding: 10px;
    }

    .chat-sidebar.collapsed .chat-icon {
        margin-right: 0;
        font-size: 1.3rem;
    }

    .chat-sidebar.collapsed .sidebar-header .btn-plus {
        display: none;
    }

    .chat-sidebar.collapsed .sidebar-profile .profile-user {
        justify-content: center;
        padding: 4px;
    }

    .chat-sidebar.collapsed .sidebar-profile .profile-item {
        justify-content: center;
        padding: 6px 0;
    }

    .chat-sidebar.collapsed .sidebar-profile .profile-icon {
        font-size: 1.2rem;
        width: auto;
    }

    .chat-sidebar.collapsed .sidebar-search {
        padding: 8px;
    }

    .chat-sidebar.collapsed .sidebar-search-input {
        padding: 6px;
        text-align: center;
        font-size: 0;
        min-height: 28px;
    }

    .chat-sidebar::-webkit-scrollbar{width:3px}
    .chat-sidebar::-webkit-scrollbar-track{background:transparent}
    .chat-sidebar::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:10px}

    /* Sidebar Header */
    .sidebar-header {
        display:flex;
        align-items:center;
        justify-content:space-between;
        padding:12px 16px 10px;
        border-bottom:var(--border-light);
        flex-shrink:0;
        min-height: 56px;
    }

    .sidebar-brand {
        display:flex;
        align-items:center;
        gap:10px;
        overflow:hidden;
    }

    .sidebar-brand-icon {
        font-size:1.4rem;
        flex-shrink:0;
        filter:drop-shadow(0 0 20px var(--neon-glow));
    }

    .sidebar-brand-text {
        font-weight:600;
        color:var(--text-primary);
        white-space:nowrap;
        letter-spacing:-0.3px;
        transition: all var(--transition);
        font-size: var(--haya-font-size);
    }

    .sidebar-brand-text small {
        font-size:0.5rem;
        font-weight:400;
        opacity:0.4;
        color:var(--text-secondary);
        display:block;
        margin-top:-1px;
        letter-spacing:0.5px;
        text-transform:uppercase;
    }

    .btn-plus {
        background:transparent;
        border:var(--border-light);
        border-radius:var(--radius-sm);
        width:30px;
        height:30px;
        color:var(--text-secondary);
        font-size:1.2rem;
        cursor:pointer;
        transition:all var(--transition);
        display:flex;
        align-items:center;
        justify-content:center;
        font-weight:300;
        flex-shrink:0;
    }
    .btn-plus:hover {
        background:var(--bg-hover);
        border-color:var(--neon-primary);
        color:var(--text-primary);
        transform:rotate(90deg);
    }

    /* Search */
    .sidebar-search {
        padding: 10px 14px;
        border-bottom: var(--border-light);
        flex-shrink: 0;
    }

    .sidebar-search-input {
        width: 100%;
        background: var(--bg-primary);
        border: var(--border-light);
        border-radius: var(--radius-sm);
        padding: 6px 12px;
        color: var(--text-primary);
        outline: none;
        transition: all var(--transition);
        min-height: 32px;
        font-size: var(--haya-font-size);
    }

    .sidebar-search-input::placeholder {
        color: var(--text-hint);
        font-size: 0.75rem;
    }

    .sidebar-search-input:focus {
        border-color: var(--neon-primary);
        box-shadow: 0 0 20px var(--neon-glow);
    }

    .list-section-title {
        color: var(--text-hint);
        font-size: .55rem;
        text-transform: uppercase;
        letter-spacing: 1.2px;
        padding: 12px 16px 4px;
        font-weight: 600;
        opacity: 0.6;
        transition: all var(--transition);
    }

    .chat-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 14px;
        cursor: pointer;
        transition: all var(--transition);
        color: var(--text-secondary);
        border-left: 2px solid transparent;
        user-select: none;
        position: relative;
        margin: 0 6px;
        border-radius: var(--radius-sm);
    }
    .chat-item:hover { 
        background: var(--bg-hover);
        color: var(--text-primary);
    }
    .chat-item.active { 
        background: var(--bg-hover);
        border-left-color: var(--neon-primary);
        color: var(--text-primary);
    }
    .chat-item.active .chat-icon {
        filter: drop-shadow(0 0 12px var(--neon-glow));
    }
    .chat-icon { 
        font-size: 1.1rem; 
        flex-shrink:0; 
        width: 22px;
        text-align: center;
        transition: all var(--transition);
    }
    .chat-name { 
        flex:1; 
        white-space:nowrap; 
        overflow:hidden; 
        text-overflow:ellipsis;
        font-weight: 450;
        transition: all var(--transition);
        font-size: var(--haya-font-size);
    }
    .chat-badge {
        background: var(--neon-primary);
        color: #0b150b;
        font-size: .55rem;
        font-weight: 600;
        padding: 1px 7px;
        border-radius: 12px;
        min-width: 18px;
        text-align: center;
        flex-shrink:0;
        box-shadow: 0 0 16px var(--neon-glow);
        transition: all var(--transition);
    }
    .chat-badge.danger {
        background: #ff4f4f;
        box-shadow: 0 0 16px rgba(255,79,79,0.2);
    }
    .chat-badge.warning {
        background: #ffbf3f;
        box-shadow: 0 0 16px rgba(255,191,63,0.2);
    }
    .chat-item .chat-actions { 
        display:none; 
        gap:4px; 
        flex-shrink:0; 
    }
    .chat-item:hover .chat-actions { 
        display:flex; 
    }
    .chat-item .chat-actions button { 
        background:transparent; 
        border:none; 
        color:var(--text-hint); 
        cursor:pointer; 
        padding:2px 5px; 
        font-size:.7rem; 
        border-radius:4px; 
        transition:var(--transition); 
    }
    .chat-item .chat-actions button:hover { 
        color:#ff6b6b; 
        background:rgba(255,0,0,0.08); 
    }

    /* ===== PROFILE ===== */
    .sidebar-profile {
        margin-top: auto;
        border-top: var(--border-light);
        padding: 10px 14px 12px;
        flex-shrink:0;
        background: var(--bg-primary);
        transition: all var(--transition);
    }

    .sidebar-profile .profile-user {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 6px 6px 2px;
        border-radius: var(--radius-sm);
        transition: var(--transition);
        cursor: default;
    }

    .sidebar-profile .profile-user:hover {
        background: var(--bg-hover);
    }

    /* Avatar */
    .profile-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        flex-shrink: 0;
        position: relative;
        border: 2px solid rgba(62, 255, 110, 0.15);
        box-shadow: 0 0 20px var(--neon-glow);
        overflow: hidden;
        cursor: pointer;
        transition: all var(--transition);
        background: radial-gradient(circle at 30% 30%, var(--neon-secondary), var(--neon-primary));
    }

    .profile-avatar:hover {
        transform: scale(1.05);
        border-color: var(--neon-primary);
        box-shadow: 0 0 30px var(--neon-glow-strong);
    }

    .profile-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .profile-avatar .avatar-fallback {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 0.9rem;
        color: #0b150b;
        background: radial-gradient(circle at 30% 30%, var(--neon-secondary), var(--neon-primary));
    }

    .profile-avatar .avatar-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transition: opacity var(--transition);
        border-radius: 50%;
        font-size: 1rem;
        color: #fff;
        backdrop-filter: blur(2px);
    }

    .profile-avatar:hover .avatar-overlay {
        opacity: 1;
    }

    .profile-avatar .status-dot-sidebar {
        position: absolute;
        bottom: -1px;
        right: -1px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        border: 2px solid var(--bg-secondary);
        z-index: 2;
    }

    .status-dot-sidebar.online {
        background: var(--neon-primary);
        box-shadow: 0 0 16px var(--neon-glow-strong);
        animation: pulse-dot 2s infinite;
    }

    .status-dot-sidebar.offline {
        background: #4f4f4f;
    }

    @keyframes pulse-dot {
        0%, 100% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.5; transform: scale(0.8); }
    }

    .profile-info {
        flex: 1;
        overflow: hidden;
        transition: all var(--transition);
    }

    .profile-name {
        font-weight: 500;
        color: var(--text-primary);
        white-space: nowrap;
        line-height: 1.3;
        font-size: var(--haya-font-size);
    }

    .profile-status {
        color: var(--text-hint);
        line-height: 1.2;
        font-size: var(--haya-font-size);
    }

    .profile-actions {
        display: flex;
        gap: 2px;
        transition: all var(--transition);
    }

    .profile-actions button {
        background: transparent;
        border: var(--border-light);
        border-radius: var(--radius-sm);
        color: var(--text-hint);
        padding: 4px 7px;
        cursor: pointer;
        transition: all var(--transition);
        font-size: 0.8rem;
    }

    .profile-actions button:hover {
        border-color: var(--neon-primary);
        color: var(--text-primary);
        background: var(--bg-hover);
    }

    .sidebar-profile .profile-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 4px;
        border-radius: var(--radius-sm);
        transition: var(--transition);
        cursor: default;
    }
    .sidebar-profile .profile-item.clickable {
        cursor: pointer;
    }
    .sidebar-profile .profile-item.clickable:hover {
        background: var(--bg-hover);
    }
    .sidebar-profile .profile-item.danger:hover {
        background: rgba(255,0,0,0.06);
    }
    .sidebar-profile .profile-icon {
        font-size: 1rem;
        width: 24px;
        text-align: center;
        flex-shrink:0;
    }
    .sidebar-profile .profile-label {
        color: var(--text-secondary);
        transition: all var(--transition);
        font-size: var(--haya-font-size);
    }
    .sidebar-profile .profile-label.danger {
        color: #ff6b6b;
    }
    .sidebar-profile .profile-label .balance-amount {
        color: var(--neon-primary);
        font-weight: 600;
    }
    .sidebar-profile .profile-hint {
        font-size: 0.5rem;
        color: var(--text-hint);
        opacity: 0.5;
        margin-left: 4px;
        transition: all var(--transition);
    }

    /* ===== TOGGLE BUTTON ===== */
    .sidebar-collapse-toggle {
        position: absolute;
        bottom: 50%;
        right: -10px;
        transform: translateY(50%);
        background: var(--bg-secondary);
        border: var(--border-light);
        border-radius: 50%;
        width: 20px;
        height: 20px;
        color: var(--text-hint);
        cursor: pointer;
        transition: all var(--transition);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.55rem;
        z-index: 10;
        box-shadow: 0 0 16px rgba(0,0,0,0.5);
    }

    .sidebar-collapse-toggle:hover {
        border-color: var(--neon-primary);
        color: var(--text-primary);
        box-shadow: 0 0 24px var(--neon-glow);
        background: var(--bg-hover);
    }

    .chat-sidebar.collapsed .sidebar-collapse-toggle {
        transform: translateY(50%) rotate(180deg);
    }

    /* ===== CHAT MAIN ===== */
    .chat-main { 
        flex:1; 
        display:flex; 
        flex-direction:column; 
        overflow:hidden; 
        min-width:0;
        height: 100%;
        background: var(--bg-primary);
        align-items: stretch;
    }

    /* ===== MESSAGES WRAPPER ===== */
    .messages-wrapper { 
        flex:1; 
        overflow:hidden; 
        position:relative; 
        display:flex; 
        flex-direction:column;
        min-height: 0;
        background: var(--bg-primary);
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0 auto;
    }

    .messages {
        flex:1; 
        overflow-y:auto; 
        padding:12px 16px; 
        display:flex; 
        flex-direction:column; 
        gap:4px; 
        scroll-behavior:smooth;
        min-height: 0;
        width: 100%;
        max-width: 900px;
        margin: 0 auto;
    }

    .messages::-webkit-scrollbar{width:4px}
    .messages::-webkit-scrollbar-track{background:transparent}
    .messages::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:10px}

    /* ===== MESSAGE ===== */
    .message {
        padding: 8px 14px;
        border-radius: var(--radius-md);
        line-height: 1.5;
        word-wrap: break-word;
        animation: fadeIn .2s ease;
        font-size: var(--haya-font-size);
        max-width: 90%;
        width: fit-content;
        min-width: 40px;
        position: relative;
    }

    @keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}

    .message.user {
        background: var(--bg-hover);
        color: var(--text-primary);
        align-self: flex-end;
        border-bottom-right-radius: 4px;
        border: var(--border-light);
        margin-right: 0;
        margin-left: auto;
    }

    .message.bot {
        background: var(--bg-secondary);
        color: var(--text-secondary);
        align-self: flex-start;
        border-bottom-left-radius: 4px;
        border: var(--border-light);
        margin-left: 0;
        margin-right: auto;
    }

    .message.system {
        background: rgba(255,255,255,0.03);
        color: var(--text-hint);
        align-self: center;
        padding: 4px 14px;
        border-radius: 20px;
        border: var(--border-light);
        max-width: 80%;
        font-size: calc(var(--haya-font-size) * 0.8);
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .message.error {
        background: rgba(255,0,0,0.06);
        color: #ff6b6b;
        align-self: center;
        border: 1px solid rgba(255,0,0,0.1);
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .message .timestamp {
        margin-top: 3px;
        display: block;
        opacity: 0.4;
        font-size: calc(var(--haya-font-size) * 0.55);
    }

    .message .nickname-label {
        display: block;
        margin-bottom: 2px;
        font-weight: 450;
        font-size: calc(var(--haya-font-size) * 0.7);
        opacity: 0.7;
    }

    /* ===== TYPING ===== */
    .typing-indicator{display:none;align-self:flex-start;background:var(--bg-secondary);padding:8px 16px;border-radius:var(--radius-md);border-bottom-left-radius:4px;border:var(--border-light);gap:4px;margin-left:16px;margin-bottom:2px}
    .typing-indicator.show{display:flex}
    .typing-indicator span{width:7px;height:7px;background:var(--text-muted);border-radius:50%;animation:typingBounce 1.4s infinite}
    .typing-indicator span:nth-child(2){animation-delay:.2s}
    .typing-indicator span:nth-child(3){animation-delay:.4s}
    @keyframes typingBounce{0%,60%,100%{transform:translateY(0);opacity:.3}30%{transform:translateY(-6px);opacity:1}}

    /* ===== INPUT AREA ===== */
    .input-area {
        padding: 8px 16px 10px;
        background: var(--bg-secondary);
        border-top: var(--border-light);
        flex-shrink: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        position: relative;
        z-index: 15;
        transition: padding 0.2s ease, background 0.2s ease;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .input-area.focused {
        padding: 6px 12px 6px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .input-wrapper {
        display: flex;
        gap: 4px;
        align-items: flex-end;
        width: 100%;
        max-width: 900px;
        background: var(--bg-primary);
        border: var(--border-light);
        border-radius: var(--radius-md);
        padding: 4px 6px;
        transition: all var(--transition);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
    .input-area .input-tools {
        display: flex;
        gap: 2px;
        align-items: center;
        flex-shrink: 0;
    }
    .input-area .input-tools button {
        background:transparent;
        border:var(--border-light);
        border-radius:var(--radius-sm);
        color:var(--text-hint);
        padding:4px 6px;
        cursor:pointer;
        font-size:1rem;
        transition:var(--transition);
        height:32px;
        display:flex;
        align-items:center;
        justify-content:center;
    }
    .input-area .input-tools button:hover {
        background:var(--bg-hover);
        border-color:var(--neon-primary);
        color:var(--text-primary);
    }
    .input-area .input-tools button.active {
        border-color:var(--neon-primary);
        background:var(--bg-hover);
        color:var(--text-primary);
    }
    .input-area textarea {
        flex:1;
        background:var(--bg-primary);
        border:var(--border-light);
        border-radius:var(--radius-sm);
        padding:6px 12px;
        color:var(--text-primary);
        font-family:inherit;
        resize:none;
        outline:none;
        transition:var(--transition);
        min-height:32px;
        max-height:30px;
        line-height:1.4;
        height:32px;
        font-size: var(--haya-font-size);
    }
    .input-area textarea:focus {
        border-color:var(--neon-primary);
        box-shadow:0 0 20px var(--neon-glow);
    }
    .input-area textarea::placeholder{color:var(--text-hint)}
    .input-area .btn-send {
        background:linear-gradient(135deg, #1f3a1f, #2a4a2a);
        border:var(--border-light);
        color:var(--text-primary);
        padding:4px 14px;
        border-radius:var(--radius-sm);
        font-weight:500;
        cursor:pointer;
        transition:var(--transition);
        white-space:nowrap;
        height:32px;
        display:flex;
        align-items:center;
        gap:4px;
        font-size: var(--haya-font-size);
    }
    .input-area .btn-send .send-icon { display:inline; }
    .input-area .btn-send .send-text { display:inline; }
    .input-area .btn-send:hover:not(:disabled) {
        background:var(--neon-primary);
        color:#0b150b;
        border-color:var(--neon-secondary);
        box-shadow:0 0 30px var(--neon-glow);
    }
    .input-area .btn-send:active:not(:disabled){transform:scale(.96)}
    .input-area .btn-send:disabled{opacity:.4;cursor:not-allowed}

    /* ===== EMOJI PANEL ===== */
    .emoji-panel {
        display:none;
        background:var(--bg-secondary);
        border:var(--border-light);
        border-radius:var(--radius-md);
        padding:8px;
        margin:0 10px 2px;
        flex-wrap:wrap;
        gap:4px;
        max-width:100%;
        box-shadow:0 4px 24px rgba(0,0,0,0.4);
    }
    .emoji-panel.active { display:flex; }
    .emoji-panel span {
        font-size:1.2rem;
        cursor:pointer;
        transition:var(--transition);
        padding:2px 4px;
        border-radius:4px;
    }
    .emoji-panel span:hover {
        background:var(--bg-hover);
        transform:scale(1.15);
    }

    /* ===== RECORDING ===== */
    .recording-indicator {
        display:none;
        align-items:center;
        gap:6px;
        padding:2px 10px;
        background:rgba(255,0,0,0.06);
        border:1px solid rgba(255,0,0,0.15);
        border-radius:20px;
        color:#ff6b6b;
        font-size:.75rem;
        animation:recPulse 1s infinite;
    }
    .recording-indicator.active{display:flex}
    @keyframes recPulse{0%,100%{opacity:1}50%{opacity:.5}}
    .recording-indicator .rec-dot {
        width:8px; height:8px; border-radius:50%; background:#ff4f4f;
        box-shadow:0 0 16px rgba(255,79,79,0.4);
        animation:recDot 0.8s infinite alternate;
    }
    @keyframes recDot{0%{transform:scale(1)}100%{transform:scale(1.3)}}

    /* ===== MODAL ===== */
    .modal-overlay {
        position:fixed; top:0; left:0; right:0; bottom:0;
        background:rgba(0,0,0,0.85);
        display:none;
        justify-content:center;
        align-items:center;
        z-index:2000;
        backdrop-filter:blur(8px);
        animation:modalFade .2s ease;
    }
    .modal-overlay.active{display:flex}
    @keyframes modalFade{from{opacity:0;transform:scale(0.96)}to{opacity:1;transform:scale(1)}}
    .modal-box {
        background:var(--bg-secondary);
        border:var(--border-light);
        border-radius:var(--radius-lg);
        padding:0;
        width:100%;
        max-width:440px;
        max-height:80vh;
        display:flex;
        flex-direction:column;
        box-shadow:0 16px 64px rgba(0,0,0,0.6);
        overflow:hidden;
    }
    .modal-header {
        display:flex; justify-content:space-between; align-items:center; padding:14px 18px; border-bottom:var(--border-light); flex-shrink:0; background:var(--bg-primary);
    }
    .modal-title{
        font-weight:500;
        color:var(--text-primary);
        font-size: var(--haya-font-size);
    }
    .modal-close{background:transparent;border:none;color:var(--text-hint);font-size:1.3rem;cursor:pointer;padding:0 4px;transition:var(--transition);line-height:1}
    .modal-close:hover{color:#ff6b6b}
    .modal-body{padding:18px;overflow-y:auto;flex:1}
    .modal-body::-webkit-scrollbar{width:3px}
    .modal-body::-webkit-scrollbar-track{background:transparent}
    .modal-body::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:10px}
    .modal-tabs{display:flex;gap:4px;margin-bottom:14px;background:var(--bg-primary);border-radius:var(--radius-sm);padding:3px}
    .modal-tab{flex:1;padding:6px 10px;border:none;background:transparent;color:var(--text-hint);border-radius:var(--radius-sm);cursor:pointer;font-weight:450;transition:var(--transition);font-size: var(--haya-font-size);}
    .modal-tab:hover{color:var(--text-secondary)}
    .modal-tab.active{background:var(--bg-hover);color:var(--text-primary)}
    .modal-form-group{margin-bottom:12px}
    .modal-form-group label{display:block;color:var(--text-hint);margin-bottom:3px;font-weight:450;font-size: var(--haya-font-size);}
    .modal-form-group input,.modal-form-group textarea{width:100%;background:var(--bg-primary);border:var(--border-light);border-radius:var(--radius-sm);padding:8px 12px;color:var(--text-primary);outline:none;transition:var(--transition);font-family:inherit;font-size: var(--haya-font-size);}
    .modal-form-group input:focus,.modal-form-group textarea:focus{border-color:var(--neon-primary);box-shadow:0 0 20px var(--neon-glow)}
    .modal-form-group textarea{resize:vertical;min-height:50px;max-height:100px}
    .user-search-container{position:relative}
    .user-search-results{position:absolute;top:calc(100%+4px);left:0;right:0;background:var(--bg-secondary);border:var(--border-light);border-radius:var(--radius-sm);max-height:120px;overflow-y:auto;display:none;z-index:10;box-shadow:0 4px 20px rgba(0,0,0,0.3)}
    .user-search-results.active{display:block}
    .user-search-results::-webkit-scrollbar{width:3px}
    .user-search-results::-webkit-scrollbar-track{background:transparent}
    .user-search-results::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:10px}
    .user-search-item{padding:6px 12px;cursor:pointer;display:flex;align-items:center;gap:8px;transition:var(--transition);color:var(--text-secondary);font-size:.85rem}
    .user-search-item:hover{background:var(--bg-hover)}
    .user-search-item .user-avatar{width:24px;height:24px;border-radius:50%;background:var(--bg-hover);display:flex;align-items:center;justify-content:center;font-size:.6rem;color:var(--text-hint);flex-shrink:0;border:var(--border-light)}
    .user-search-item .user-name{flex:1}
    .user-search-item .user-status{font-size:.65rem;color:var(--text-hint)}
    .selected-users{display:flex;flex-wrap:wrap;gap:4px;margin-top:6px}
    .user-chip{display:flex;align-items:center;gap:4px;background:var(--bg-hover);padding:2px 8px 2px 6px;border-radius:14px;font-size:.75rem;border:var(--border-light)}
    .user-chip .chip-remove{cursor:pointer;color:var(--text-hint);font-size:.7rem;transition:var(--transition);background:none;border:none;padding:0 2px}
    .user-chip .chip-remove:hover{color:#ff6b6b}
    .modal-actions{display:flex;gap:8px;margin-top:14px}
    .modal-actions button{flex:1;padding:8px;border-radius:var(--radius-sm);border:var(--border-light);font-weight:500;cursor:pointer;transition:var(--transition);font-size: var(--haya-font-size);}
    .modal-actions .btn-cancel{background:transparent;color:var(--text-hint)}
    .modal-actions .btn-cancel:hover{background:var(--bg-hover)}
    .modal-actions .btn-create{background:linear-gradient(135deg, #1f3a1f, #2a4a2a);color:var(--text-primary)}
    .modal-actions .btn-create:hover:not(:disabled){background:var(--neon-primary);color:#0b150b;border-color:var(--neon-secondary);box-shadow:0 0 30px var(--neon-glow)}
    .modal-actions .btn-create:disabled{opacity:.4;cursor:not-allowed}
    .modal-error{color:#ff6b6b;font-size:.8rem;margin-top:8px;min-height:18px}

    /* ============================================================ */
    /* ===== СТИЛИ ДЛЯ МЕНЮ ПОПОЛНЕНИЯ ТОКЕНОВ ===== */
    /* ============================================================ */
    
    .payment-modal .payment-package .package-tokens,
    .payment-modal .payment-package .package-price,
    .payment-modal .payment-package .package-bonus,
    .payment-modal .payment-info-text,
    .payment-modal .payment-label,
    .payment-modal .payment-value,
    .payment-modal .payment-title,
    .payment-modal .payment-subtitle,
    .payment-modal .payment-status,
    .payment-modal .payment-description {
        font-size: 1.1rem !important;
        color: #ffffff !important;
    }
    
    .payment-modal .balance-display {
        font-size: 1.3rem !important;
        color: #ffffff !important;
        font-weight: 700 !important;
    }
    
    .payment-modal .payment-btn {
        font-size: 1.05rem !important;
        color: #ffffff !important;
        font-weight: 600 !important;
    }
    
    .payment-modal .payment-header {
        font-size: 1.2rem !important;
        color: #ffffff !important;
        font-weight: 600 !important;
    }
    
    .payment-modal .package-price-value {
        font-size: 1.2rem !important;
        color: #ffffff !important;
        font-weight: 700 !important;
    }
    
    .payment-modal .package-tokens-value {
        font-size: 1.15rem !important;
        color: #ffffff !important;
        font-weight: 600 !important;
    }
    
    .font-size-label,
    .font-size-value {
        font-size: 1rem !important;
        color: #ffffff !important;
    }
    
    .font-size-recommendation {
        font-size: 0.95rem !important;
        color: #3eff6e !important;
    }

    /* ===== RESPONSIVE ===== */
    @media(max-width:700px){
        :root {
            --header-height: 44px;
            --input-height: 44px;
            --footer-height: 26px;
            --sidebar-width: 260px;
        }
        
        .app {
            height: 100vh;
            height: 100dvh;
            max-height: 100vh;
            max-height: 100dvh;
            border-radius: 0;
            border: none;
        }
        
        .app-content {
            height: auto;
            flex: 1;
            min-height: 0;
        }
        
        .chat-sidebar {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            width: 0;
            overflow: hidden;
            border-right: none;
            padding: 0;
            transition: width var(--transition);
            z-index: 100;
            box-shadow: 4px 0 60px rgba(0,0,0,0.8);
            border-radius: 0 16px 16px 0;
            height: 100vh;
        }
        .chat-sidebar.open{
            width: var(--sidebar-width);
            padding: 0;
            border-right: var(--border-light);
            overflow-y: auto;
        }
        .chat-sidebar.open .chat-name{display:block}
        .chat-sidebar.open .list-section-title{display:block}
        .chat-sidebar.open .chat-badge{display:block}
        .chat-sidebar.open .sidebar-brand-text{display:block}
        .chat-sidebar.open .profile-info{display:block}
        .chat-sidebar.open .profile-actions{display:flex}
        .chat-sidebar.open .sidebar-search{display:block}
        .chat-sidebar .chat-name{display:none}
        .chat-sidebar .list-section-title{display:none}
        .chat-sidebar .chat-badge{display:none}
        .chat-sidebar .sidebar-brand-text{display:none}
        .chat-sidebar .sidebar-search{display:none}
        .chat-sidebar .sidebar-collapse-toggle{display:none}
        .chat-sidebar .profile-info{display:none}
        .chat-sidebar .profile-actions{display:none}
        .chat-item{padding:8px 10px;justify-content:center}
        .chat-sidebar.open .chat-item{justify-content:flex-start}
        .sidebar-toggle{display:block}
        
        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 99;
            backdrop-filter: blur(4px);
        }
        .sidebar-overlay.active{display:block}
        
        .chat-main {
            height: 100%;
            align-items: stretch;
        }
        
        .messages-wrapper {
            padding: 0;
            max-width: 100%;
        }
        
        .messages {
            padding: 10px 12px;
        }
        
        .message {
            max-width: 92%;
        }
        
        .input-area {
            padding: 6px 8px 8px;
            padding-bottom: max(8px, env(safe-area-inset-bottom));
            gap: 4px;
            flex-shrink: 0;
        }
        
        .input-area.focused {
            padding: 4px 8px 4px;
            padding-bottom: max(4px, env(safe-area-inset-bottom));
        }
        
        .input-area textarea {
            min-height: 28px;
            max-height: 28px;
            height: 28px;
        }
        
        .input-area .btn-send {
            padding: 4px 10px;
            height: 28px;
            min-width: 34px;
        }
        
        .input-area .btn-send .send-text {
            display: none;
        }
        
        .input-area .btn-send .send-icon {
            display: inline;
            font-size: 1rem;
        }
        
        .input-area .input-tools button {
            height: 28px;
            padding: 3px 5px;
            font-size: .9rem;
        }
        
        .header {
            padding: 4px 10px;
            min-height: var(--header-height);
            height: var(--header-height);
            flex-shrink: 0;
        }
        
        .header-left .chat-title {
            font-size: calc(var(--haya-font-size) * 0.9);
        }
        
        .status-dot {
            width: 7px;
            height: 7px;
        }
        
        #statusText {
            font-size: calc(var(--haya-font-size) * 0.7);
        }
        
        .commands-hint {
            padding: 2px 10px 4px;
            gap: 4px;
            height: var(--footer-height);
            min-height: var(--footer-height);
        }
        
        .commands-hint code {
            font-size: calc(var(--haya-font-size) * 0.6);
        }
        
        .modal-box {
            margin: 12px;
            max-height: 92vh;
            border-radius: var(--radius-md);
        }
        
        .modal-body {
            padding: 14px;
        }
        
        .modal-tabs {
            flex-direction: column;
        }
        
        .modal-actions {
            flex-direction: column;
        }
        
        .btn-plus {
            width: 26px;
            height: 26px;
            font-size: 1rem;
        }
        
        .sidebar-profile {
            padding: 8px 10px;
        }
        
        .sidebar-profile .profile-item {
            padding: 4px 0;
        }
        
        .sidebar-profile .profile-label {
            font-size: calc(var(--haya-font-size) * 0.85);
        }
        
        .sidebar-profile .profile-icon {
            font-size: .9rem;
            width: 20px;
        }
        
        .profile-avatar {
            width: 32px;
            height: 32px;
        }
        
        .payment-modal .payment-package .package-tokens,
        .payment-modal .payment-package .package-price,
        .payment-modal .payment-package .package-bonus {
            font-size: 1rem !important;
        }
    }

    @media(max-width:400px){
        .auth-box{padding:20px;margin:12px}
        .auth-title{font-size:1.2rem}
        .chat-sidebar.open{width:200px}
        .input-area .btn-send{min-width:30px;padding:3px 6px}
        .input-area .btn-send .send-icon{font-size:.9rem}
    }

    @media(min-width:701px){
        .input-area .btn-send .send-icon{display:none}
        .input-area .btn-send .send-text{display:inline}
        .sidebar-overlay{display:none !important}
    }

        /* ============================================================ */
    /* ===== FEEDBACK 👍/👎 ПОД СООБЩЕНИЯМИ БОТА ===== */
    /* ============================================================ */
    
    .message-feedback {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 6px;
        opacity: 0.4;
        transition: opacity 0.2s ease;
        pointer-events: auto;
    }
    
    .message:hover .message-feedback {
        opacity: 1;
    }
    
    .message-feedback button {
        background: transparent;
        border: 1px solid rgba(62, 255, 110, 0.08);
        border-radius: 6px;
        color: var(--text-hint);
        cursor: pointer;
        font-size: 0.85rem;
        padding: 2px 8px;
        transition: all 0.2s ease;
        line-height: 1;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .message-feedback button:hover {
        border-color: var(--neon-primary);
        color: var(--text-primary);
        background: var(--bg-hover);
        transform: translateY(-1px);
    }
    
    .message-feedback button.fb-up:hover {
        border-color: #3eff6e;
        color: #3eff6e;
        box-shadow: 0 0 12px rgba(62, 255, 110, 0.15);
    }
    
    .message-feedback button.fb-down:hover {
        border-color: #ff6b6b;
        color: #ff6b6b;
        box-shadow: 0 0 12px rgba(255, 107, 107, 0.15);
    }
    
    .message-feedback button.fb-up.active {
        border-color: #3eff6e;
        color: #3eff6e;
        background: rgba(62, 255, 110, 0.06);
    }
    
    .message-feedback button.fb-down.active {
        border-color: #ff6b6b;
        color: #ff6b6b;
        background: rgba(255, 107, 107, 0.06);
    }
    
    .message-feedback button:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        transform: none;
    }
    
    .message-feedback .fb-thanks {
        font-size: 0.7rem;
        color: var(--text-hint);
        opacity: 0.7;
        animation: fbFadeIn 0.3s ease;
    }
    
    .message-feedback .fb-thanks.up {
        color: #3eff6e;
    }
    
    .message-feedback .fb-thanks.down {
        color: #ff9f7f;
    }
    
    @keyframes fbFadeIn {
        from { opacity: 0; transform: translateX(-4px); }
        to   { opacity: 1; transform: translateX(0); }
    }

    /* ============================================================ */
    /* ===== СООБЩЕНИЕ «БОТ ОФФЛАЙН» ===== */
    /* ============================================================ */

    .message.bot-offline {
        background: rgba(255, 191, 63, 0.06);
        color: #ffbf3f;
        align-self: center;
        padding: 6px 16px;
        border-radius: 20px;
        border: 1px solid rgba(255, 191, 63, 0.2);
        max-width: 85%;
        font-size: calc(var(--haya-font-size) * 0.8);
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        display: flex;
        align-items: center;
        gap: 8px;
        animation: botOfflinePulse 2s ease infinite;
    }

    .message.bot-offline .bot-offline-icon {
        font-size: 1.1rem;
        animation: botOfflineWobble 2s ease infinite;
    }

    @keyframes botOfflinePulse {
        0%, 100% { box-shadow: 0 0 0 rgba(255, 191, 63, 0); }
        50%      { box-shadow: 0 0 20px rgba(255, 191, 63, 0.1); }
    }

    @keyframes botOfflineWobble {
        0%, 100% { transform: rotate(0deg); }
        25%      { transform: rotate(-8deg); }
        75%      { transform: rotate(8deg); }
    }

    /* ============================================================ */
    /* ===== ИНДИКАТОР СТАТУСА БОТА В ХЕДЕРЕ ===== */
    /* ============================================================ */

    .bot-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 8px;
        background: rgba(62, 255, 110, 0.06);
        border: 1px solid rgba(62, 255, 110, 0.15);
        border-radius: 10px;
        font-size: 0.6rem;
        color: #3eff6e;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
    }

    .bot-status-badge.offline {
        background: rgba(255, 191, 63, 0.06);
        border-color: rgba(255, 191, 63, 0.2);
        color: #ffbf3f;
    }

    .bot-status-badge .badge-dot {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: currentColor;
        box-shadow: 0 0 8px currentColor;
        animation: badgeDotPulse 1.6s ease infinite;
    }

    @keyframes badgeDotPulse {
        0%, 100% { opacity: 1; }
        50%      { opacity: 0.4; }
    }

    /* ============================================================ */
    /* ===== АНИМАЦИЯ УДАЛЕНИЯ ПАРЫ (👎) ===== */
    /* ============================================================ */

    .message.purging {
        animation: purgeAnim 0.5s ease forwards;
    }

    @keyframes purgeAnim {
        0%   { opacity: 1; transform: translateX(0); }
        50%  { opacity: 0.6; transform: translateX(6px); }
        100% { opacity: 1; transform: translateX(0); }
    }

    /* ============================================================ */
    /* ===== ТИПИНГ ДЛЯ BOT-OFFLINE ===== */
    /* ============================================================ */

    .typing-indicator.bot-offline {
        background: rgba(255, 191, 63, 0.06);
        border-color: rgba(255, 191, 63, 0.15);
        color: #ffbf3f;
    }

    .typing-indicator.bot-offline span {
        background: #ffbf3f;
        animation: typingBounce 1.4s infinite, typingColorPulse 2s infinite;
    }

    @keyframes typingColorPulse {
        0%, 100% { opacity: 0.3; }
        50%      { opacity: 0.7; }
    }

    /* ============================================================ */
    /* ===== АДАПТИВ ДЛЯ FEEDBACK ===== */
    /* ============================================================ */

    @media (max-width: 700px) {
        .message-feedback {
            opacity: 0.6;
        }
        .message-feedback button {
            font-size: 0.8rem;
            padding: 2px 6px;
        }
        .message.bot-offline {
            font-size: calc(var(--haya-font-size) * 0.75);
            padding: 5px 12px;
        }
        .bot-status-badge {
            display: none;
        }
    }


/* ============================================================ */
/* ===== ВЫДЕЛЕНИЕ СООБЩЕНИЙ (копирование / удаление) ===== */
/* ============================================================ */

.message {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

/* Подсветка выбранного сообщения */
.message.selected {
    background: rgba(62, 255, 110, 0.06) !important;
    box-shadow: 0 0 0 1px rgba(62, 255, 110, 0.25), 0 0 20px rgba(62, 255, 110, 0.08);
}

.message.system.selected,
.message.error.selected {
    box-shadow: 0 0 0 1px rgba(255, 191, 63, 0.3);
}

/* Панель действий над сообщением */
.message-actions {
    position: absolute;
    top: -38px;
    right: 8px;
    display: flex;
    gap: 4px;
    padding: 4px 6px;
    background: var(--bg-secondary);
    border: 1px solid rgba(62, 255, 110, 0.2);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 20px rgba(62, 255, 110, 0.06);
    z-index: 5;
    animation: actionsFadeIn 0.15s ease;
    white-space: nowrap;
}

@keyframes actionsFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message-actions button {
    background: transparent;
    border: 1px solid rgba(62, 255, 110, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 10px;
    transition: all 0.15s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-actions button:hover {
    background: var(--bg-hover);
    border-color: var(--neon-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.message-actions button.action-delete:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.06);
}

/* Тултип-подсказка для кнопок на мобильных */
.message-actions button::after {
    content: attr(data-label);
    font-size: 0.7rem;
}

/* На мобильных — панель чуть компактнее и не вылезает за край */
@media (max-width: 700px) {
    .message-actions {
        top: -34px;
        right: 4px;
        padding: 3px 4px;
    }
    .message-actions button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    .message-actions button::after {
        display: none; /* на мобилке оставляем только иконки */
    }
}