/* ════════════════════════════════════════════════════════════════
   XSSM — Sidebar
   ════════════════════════════════════════════════════════════════ */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px;
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
    border-radius: var(--radius-full, 9999px);
    padding: 5px 12px 5px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    transition: all 0.2s var(--ease);
}
.sidebar-brand:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}
.sidebar-brand:active {
    transform: scale(0.97);
}
.sidebar-brand-icon {
    width: 34px; height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.88rem; color: #fff;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.sidebar-brand span {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--text-primary);
}
.sidebar-action-btn {
    width: 34px; height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-action-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
    transform: translateY(-1px);
}

.modern-sidebar {
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
    height: calc(100vh - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    background: rgba(14, 18, 34, 0.52) !important;
    backdrop-filter: blur(32px) saturate(220%) !important;
    -webkit-backdrop-filter: blur(32px) saturate(220%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
    margin: 12px 10px 12px 12px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1.5px 2px rgba(255, 255, 255, 0.28) !important;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
    overflow: hidden;
}

.modern-sidebar > .sidebar-content {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: calc(100% - 120px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
    padding: 4px 8px 8px;
}

.modern-sidebar > .sidebar-dock {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    margin-top: auto !important;
    min-height: 56px !important;
    border-radius: 0 0 12px 12px;
    z-index: 25;
    display: flex !important;
}

.modern-sidebar > * {
    position: relative;
    z-index: 1;
}

/* ── Поиск ── */
.sidebar-dsearch {
    padding: 14px 14px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dsearch-pill {
    flex: 1;
    display: flex;
    align-items: center;
    height: 40px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    padding: 0 4px 0 14px;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), inset 0 0.5px 0.5px rgba(255,255,255,0.12);
}
.dsearch-pill:focus-within {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 2px 8px rgba(99, 102, 241, 0.08);
}
.dsearch-icon {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    display: flex;
    opacity: 0.7;
}
.dsearch-pill:focus-within .dsearch-icon {
    color: var(--accent);
    opacity: 1;
}
.dsearch-field {
    flex: 1;
    min-width: 0;
}
.dsearch-field input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 450;
    letter-spacing: -0.01em;
    outline: none;
    padding: 0;
}
.dsearch-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.dsearch-clear {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    transition: all 0.18s var(--spring);
    flex-shrink: 0;
}
.dsearch-clear.visible {
    display: flex;
}
.dsearch-clear:hover {
    background: var(--text-muted);
    color: var(--bg-base);
    transform: scale(1.14);
}

.dsearch-new {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(140deg, var(--accent-dark), var(--accent));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(99, 102, 241, 0.35);
    position: relative;
    overflow: hidden;
}
.dsearch-new::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at 30% 22%,
        rgba(255, 255, 255, 0.22),
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.22s;
}
.dsearch-new:hover {
    transform: translateY(-1px) scale(1.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 20px rgba(99, 102, 241, 0.45);
}
.dsearch-new:hover::after {
    opacity: 1;
}
.dsearch-new:active {
    transform: scale(0.92);
}

/* ── Табы ── */
.sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 0 14px 10px;
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 14px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.sidebar-tab i {
    font-size: 0.75rem;
    transition: all 0.22s var(--spring);
    opacity: 0.55;
}
.sidebar-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}
.sidebar-tab.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.sidebar-tab.active i {
    opacity: 1;
    transform: scale(1.1);
    color: var(--accent-light);
}
.sidebar-tab:active {
    transform: scale(0.94);
}

/* ── Контентная область ── */
.sidebar-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 68px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.07) transparent;
}
.sidebar-content::-webkit-scrollbar {
    width: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.14);
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Элементы чатов ── */
.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    cursor: pointer;
    border-radius: 16px;
    position: relative;
    transition:
        background 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.chat-item:hover .chat-avatar {
    transform: scale(1.06);
}
.chat-item:active {
    transform: scale(0.98);
}
.chat-item.active {
    background: rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.chat-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
    border-radius: 0 4px 4px 0;
}
.chat-item.active .chat-name {
    color: var(--accent-light);
}
.chat-item.active .chat-avatar {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 2.5px var(--accent);
}
.chat-item.animate-in {
    animation: chatSlideIn 0.44s var(--spring) both;
    animation-delay: calc(var(--i, 0) * 22ms);
}

/* Chat data may refresh in the background. On desktop that must not replay an
   entrance animation for the whole navigation list during a chat switch. */
@media (min-width: 769px) {
    #chats-list .chat-item.animate-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ── Аватары ── */
.chat-avatar {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 2px 10px rgba(0, 0, 0, 0.3);
    transition:
        transform 0.22s var(--spring),
        box-shadow 0.18s var(--ease);
    overflow: hidden;
    flex-shrink: 0;
}
.chat-avatar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 28% 22%,
        rgba(255, 255, 255, 0.19),
        transparent 55%
    );
    pointer-events: none;
}
.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    position: relative;
    z-index: 1;
}
.chat-avatar.online::after {
    content: "";
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: var(--green);
    border: 2px solid rgba(9, 11, 20, 0.98);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
}
.channel-avatar {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 50%;
    background: linear-gradient(140deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 2px 10px rgba(245, 158, 11, 0.25);
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Мета-информация чата ── */
.chat-info {
    flex: 1;
    min-width: 0;
}
.chat-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
    transition: color 0.18s;
}
.chat-preview {
    color: var(--text-muted);
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.chat-time {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-weight: 500;
}
.unread-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}
.chat-pin-icon {
    font-size: 0.52rem;
    color: var(--accent);
    margin-right: 3px;
    vertical-align: middle;
    opacity: 0.48;
}

/* ── Нижний «док» (профиль + кнопки) — Authentic Sidebar Part ── */
.sidebar-dock {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 10px;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    box-shadow: none !important;
}

.dock-profile {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 4px;
    border-radius: 20px;
    cursor: pointer;
    min-width: 0;
}

.dock-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.55rem;
    color: #fff;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}
.dock-avatar::after {
    content: "";
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background: var(--green);
    border: 2px solid rgba(10, 14, 26, 0.9);
    border-radius: 50%;
}

.dock-info {
    flex: 1;
    min-width: 0;
}
.dock-name {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.dock-status {
    font-size: 0.6rem;
    color: var(--green);
    font-weight: 500;
    line-height: 1.2;
}

.dock-status.custom-status {
    color: rgba(190, 176, 255, 0.88);
    font-weight: 650;
}

[data-theme="light"] .dock-status.custom-status {
    color: #6d58bc;
}

.dock-chevron {
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.35rem;
    opacity: 0.15;
    flex-shrink: 0;
}

.dock-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    padding-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.dock-action {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    position: relative;
}
.dock-action:hover {
    color: rgba(255, 255, 255, 0.5);
}
.dock-action i {
    transition: color 0.15s ease;
}

/* Desktop: hide mobile dock buttons */
.dock-trailing { display: none; }

/* ════════════════════════════════════════════════════════════
   СИСТЕМНЫЕ ЭЛЕМЕНТЫ (Избранное + Архив)
   ════════════════════════════════════════════════════════════ */
.sidebar-sys-items {
    padding-top: 2px;
}

/* Бейдж «оставить предложение» */
@keyframes suggest-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes suggest-glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.sys-suggest-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    margin: 4px 2px 8px;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 16px;
    position: relative;
    transition:
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        border-color 0.3s var(--ease),
        box-shadow 0.3s var(--ease);
    -webkit-tap-highlight-color: transparent;
    background-color: rgba(14, 18, 34, 0.72);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    background-image: linear-gradient(
        110deg,
        rgba(139, 124, 246, 0.10),
        rgba(129, 140, 248, 0.06),
        rgba(99, 102, 241, 0.10),
        rgba(180, 164, 252, 0.07),
        rgba(139, 124, 246, 0.10)
    );
    background-size: 250% 250%;
    animation: suggest-shimmer 6s ease-in-out infinite;
    border: 1px solid rgba(139, 124, 246, 0.18);
    overflow: hidden;
}
.sys-suggest-banner::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #b4a4fc, #818cf8, #6366f1);
    animation: suggest-glow 3s ease-in-out infinite;
}
.sys-suggest-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at 20% 50%,
        rgba(180, 164, 252, 0.08),
        transparent 70%
    );
    pointer-events: none;
}
.sys-suggest-banner:hover {
    transform: translateY(-1px);
    border-color: rgba(139, 124, 246, 0.38);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.14);
}
.sys-suggest-banner:active {
    transform: scale(0.985);
}
.sys-suggest-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    background: linear-gradient(140deg, #b4a4fc, #818cf8, #6366f1);
    background-size: 180% 180%;
    animation: suggest-shimmer 4s ease-in-out infinite;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 3px 14px rgba(139, 124, 246, 0.35);
}
.sys-suggest-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.sys-suggest-title {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 1px;
    letter-spacing: -0.01em;
}
.sys-suggest-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sys-suggest-close {
    flex-shrink: 0;
    opacity: 0.4;
    position: relative;
    z-index: 1;
    transition: opacity 0.15s var(--ease);
}
.sys-suggest-close:hover {
    opacity: 1;
}
.sys-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    cursor: pointer;
    border-radius: 16px;
    position: relative;
    transition:
        background 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
}
.sys-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.sys-item:active {
    transform: scale(0.98);
}
.sys-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 4px 12px rgba(0, 0, 0, 0.25);
}
.sys-icon-saved {
    background: linear-gradient(140deg, #4f9ef8, #818cf8);
}
.sys-icon-calls {
    background: linear-gradient(140deg, #24c38e, #36a8df);
}
.sys-icon-planner {
    background: linear-gradient(140deg, #e09b3d, #e36e70);
}
.sys-icon-requests {
    background: linear-gradient(140deg, #9b72f2, #e26fb5);
}
.sys-icon-archive {
    background: linear-gradient(140deg, #818cf8, #6366f1);
}
.sys-info {
    flex: 1;
    min-width: 0;
}
.sys-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.sys-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.sys-meta {
    flex-shrink: 0;
}
.sys-badge {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Pull-hint */
.pull-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    transition:
        height 0.22s var(--ease),
        opacity 0.22s var(--ease);
    pointer-events: none;
}
.pull-hint.pull-hint-on {
    height: 30px;
    opacity: 0.5;
}
.pull-hint i {
    animation: pullBounce 0.9s ease infinite;
}
@keyframes pullBounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(5px);
    }
}

/* Mobile sys-item overrides */
@media (max-width: 768px) {
    .pull-hint {
        display: flex;
    }
    .sys-item {
        padding: 10px 12px;
        gap: 12px;
        border-radius: 16px;
    }
    .sys-icon {
        width: 52px;
        height: 52px;
        min-width: 52px;
        font-size: 1.1rem;
    }
    .sys-name {
        font-size: 0.96rem;
    }
    .sys-sub {
        font-size: 0.83rem;
    }

    /* Архив: скрыт по умолчанию на мобиле сразу, без ждания JS */
    .sys-archive {
        height: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
        /* Без transition чтобы не было мигания при загрузке */
        transition: none !important;
    }
    /* Показан после pull-down */
    .sys-archive.sys-arch-shown {
        height: auto !important;
        opacity: 1 !important;
        padding: 10px 12px !important;
        margin-bottom: 2px !important;
        overflow: visible !important;
        pointer-events: auto !important;
    }
    /* Плавная анимация при скрытии */
    .sys-archive.sys-arch-anim {
        transition:
            height 0.3s var(--ease),
            opacity 0.3s var(--ease),
            padding 0.3s var(--ease),
            margin 0.3s var(--ease) !important;
    }
}

/* Sidebar header two buttons */
.sidebar-header-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ════════════════════════════════════════════════════════════
   ПРОФИЛЬ В НАСТРОЙКАХ — аватар + карточки
   ════════════════════════════════════════════════════════════ */

/* Баннер профиля — верхняя часть первой карточки */
.prof-id-card > div:first-child {
    border-radius: 14px 14px 0 0 !important;
}

/* ═ Hero-заголовок вкладки «Профиль» ═ */
.settings-profile-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.1rem;
    padding: 16px 18px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), color-mix(in srgb, var(--accent-dark) 3%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border-faint));
    border-radius: var(--radius-lg);
}
.profile-hero-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent);
}
.profile-hero-text h2 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0 0 1px;
    line-height: 1.25;
}
.profile-hero-text p {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
}
[data-theme="light"] .settings-profile-hero {
    border-color: color-mix(in srgb, var(--accent) 14%, rgba(0,0,0,0.06));
}
@media (max-width: 600px) {
    .settings-profile-hero { padding: 13px 14px; gap: 11px; }
    .profile-hero-icon { width: 40px; height: 40px; min-width: 40px; font-size: 1rem; border-radius: 11px; }
    .profile-hero-text h2 { font-size: 1.05rem; }
}

/* ═ Account switcher inside settings Profile tab ═ */
.pacc-card {
    margin-bottom: 14px;
    background: var(--bg-island);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.pacc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}
.pacc-header i {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 25%, transparent);
}
.pacc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s var(--ease);
    border-top: 1px solid var(--border-faint);
}
.pacc-row:hover { background: var(--bg-hover); }
.pacc-row.pacc-active {
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.pacc-av {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 6px rgba(0,0,0,0.15);
}
.pacc-fb {
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
}
.pacc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pacc-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pacc-badge {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.pacc-chevron {
    color: var(--text-muted);
    font-size: 0.65rem;
    opacity: 0.4;
    flex-shrink: 0;
}
.pacc-row:hover .pacc-chevron { opacity: 0.7; }
.pacc-rm {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    opacity: 0.4;
    transition: all 0.15s;
}
.pacc-row:hover .pacc-rm { opacity: 1; }
.pacc-rm:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    opacity: 1;
}
.pacc-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px 12px;
    border-top: 1px solid var(--border-faint);
}
.pacc-btn {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s var(--ease);
}
.pacc-btn i { font-size: 0.75rem; }
.pacc-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.pacc-btn-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 7%, transparent);
}
[data-theme="light"] .pacc-row:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .pacc-row.pacc-active { background: color-mix(in srgb, var(--accent) 5%, transparent); }
[data-theme="light"] .pacc-btn { border-color: rgba(0,0,0,0.1); }

/* Аватар-секция: аватар высовывает над баннером */
.prof-av-section {
    padding-top: 0 !important;
}
.prof-av-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 0 0 4px;
}
.prof-av-floating {
    margin-top: -34px !important;
    position: relative;
    z-index: 2;
}
.prof-av-floating img {
    border: 3px solid var(--bg-surface, #101422) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="light"] .prof-av-floating img {
    border-color: #fff !important;
}
.prof-av-text {
    flex: 1;
    min-width: 0;
    padding-bottom: 2px;
}
.prof-av-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prof-av-email {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: responsive profile */
@media (max-width: 600px) {
    .prof-av-floating img {
        border-width: 2px !important;
    }
    .prof-av-name {
        font-size: 0.95rem;
    }
}

/* ══════════════════════════════════════════════════════════
   ПРОФИЛЬ — ОБЛОЖКА + EMAIL-РЯД (классовый реворк)
   ══════════════════════════════════════════════════════════ */

/* Баннер обложки профиля */
.prof-cover {
    position: relative;
    width: 100%;
    height: 92px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: flex-end;
    gap: 0.7rem;
    padding: 0 18px 12px;
    overflow: hidden;
    transition: background 0.3s var(--ease);
}
.prof-cover-av {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.25);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.prof-cover-meta { z-index: 1; min-width: 0; }
.prof-cover-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prof-cover-sub {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.75);
    margin-top: 1px;
}

/* E-mail ряд в карточке идентификации */
.prof-email-field {
    border: 1px solid rgba(139,124,246,0.06);
    border-radius: 14px;
    padding: 14px 14px 10px;
    margin-top: 2px;
    background: rgba(139,124,246,0.02);
}
.prof-email-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.prof-email-ic {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139,124,246,0.1), rgba(99,102,241,0.03));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(139,124,246,0.06);
}
.prof-email-ic i { font-size: 16px; color: var(--purple-light, #8b7cf6); }
.prof-email-meta { flex: 1; min-width: 0; }
.prof-email-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prof-email-badge { display: none; margin-top: 2px; }
.prof-email-edit {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid rgba(139,124,246,0.08);
    color: var(--purple-light, #8b7cf6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.prof-email-edit:hover { background: rgba(139,124,246,0.06); }
.prof-email-edit i { font-size: 12px; }
.prof-email-hidden { display: none; }
.prof-email-form {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(139,124,246,0.06);
}
.prof-email-form.active { display: block; }
.prof-email-step { }
.prof-email-formrow { display: flex; gap: 8px; align-items: center; }
.prof-email-code {
    flex: 1;
    padding: 9px 12px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}
.prof-email-error { color: #f87171; font-size: 11px; margin-top: 6px; }

/* Заголовки секций + карточка обложки */
.prof-fh { margin-bottom: 0.75rem; }
.prof-cover-card { gap: 0.6rem; }
.prof-cover-pickers {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.5rem;
}
.prof-picker-col { flex: 1; min-width: 0; }
.prof-picker-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.prof-picker-grid { display: grid; gap: 0.35rem; }
.cover-color-grid { grid-template-columns: repeat(5, 1fr); }
.cover-pattern-grid { grid-template-columns: repeat(3, 1fr); }
.prof-social-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.prof-social-add {
    margin-top: 0.6rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════
   ПРОФИЛЬ — ИЗЯЩНЫЙ РЕДИЗАЙН (refined / elegant)
   ══════════════════════════════════════════════════════════ */

/* Заголовок раздела — лёгкий, без тяжёлого градиент-бокса */
.settings-profile-hero {
    background: transparent;
    border: none;
    padding: 4px 2px 12px;
    margin-bottom: 0.4rem;
    gap: 12px;
}
.profile-hero-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.profile-hero-text h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.profile-hero-text p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Карточки — мягкие «острова» */
.settings-card {
    background: var(--bg-island);
    border: 1px solid var(--border-faint);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 10px 28px -14px rgba(0,0,0,0.28);
    margin-bottom: 14px;
}
.settings-card-section { padding: 18px 20px; }

/* Аккаунты — изящные строки */
.pacc-card {
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 10px 28px -14px rgba(0,0,0,0.28);
}
.pacc-header { padding: 16px 18px 12px; font-size: 0.84rem; }
.pacc-header i {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 28%, transparent);
}
.pacc-row {
    padding: 12px 18px;
    transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.pacc-row:hover { background: var(--bg-hover); transform: translateX(2px); }
.pacc-av {
    width: 42px; height: 42px; min-width: 42px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 3px 8px rgba(0,0,0,0.2);
}
.pacc-name { font-size: 0.9rem; font-weight: 600; }
.pacc-badge {
    background: color-mix(in srgb, #34d399 14%, transparent);
    color: #34d399;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #34d399 25%, transparent);
    padding: 3px 9px;
}
.pacc-actions { padding: 12px 18px 16px; }
.pacc-btn { padding: 11px 12px; border-radius: 13px; font-size: 0.8rem; }

/* Обложка профиля — изящная, с лёгкой текстурой */
.prof-cover {
    height: 104px;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    padding: 0 20px 14px;
    gap: 0.8rem;
}
.prof-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 18px 18px 0 0;
    background: radial-gradient(circle at 82% 18%, rgba(255,255,255,0.14), transparent 42%);
    pointer-events: none;
}
.prof-cover-av {
    width: 48px; height: 48px; min-width: 48px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.prof-cover-name { font-size: 1rem; }

/* Тело идентификации — крупный аватар + имя */
.prof-id-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px 18px;
    margin-top: -38px;
    position: relative;
    z-index: 2;
}
.prof-id-av-wrap { position: relative; flex-shrink: 0; }
.prof-id-av {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-island);
    background: var(--bg-elevated);
    box-shadow: 0 6px 22px rgba(0,0,0,0.3), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
    display: block;
}
[data-theme="light"] .prof-id-av { border-color: #fff; }
.prof-id-av-edit {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border: 2px solid var(--bg-island);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.15s var(--ease);
}
[data-theme="light"] .prof-id-av-edit { border-color: #fff; }
.prof-id-av-edit:hover { transform: scale(1.12); }
.prof-id-meta { flex: 1; min-width: 0; padding-bottom: 2px; }
.prof-id-name {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prof-id-tag {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Email-поле — мягче */
.prof-email-field {
    border-radius: 16px;
    padding: 14px 16px 12px;
    background: color-mix(in srgb, var(--accent) 3%, transparent);
}
.prof-email-val { font-size: 0.85rem; }
.prof-email-badge { font-size: 11px; }

/* Cover pickers — изящные плитки */
.prof-picker-grid { gap: 0.5rem; }
.cover-color-grid > div,
.cover-color-grid .cover-color-opt {
    border-radius: 12px;
    aspect-ratio: 1;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.cover-color-grid > div:hover { transform: scale(1.08); }
.cover-pattern-grid > div,
.cover-pattern-grid .cover-pattern-opt {
    border-radius: 14px;
    padding: 10px 8px;
}

/* Соцсети */
.prof-social-list { gap: 0.6rem; }
.prof-social-add {
    border-radius: 12px;
    padding: 10px 14px;
}

/* Кнопка сохранения — акцентная пилюля */
.settings-save-btn {
    border-radius: 16px;
    padding: 1rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* Light theme — combined in style.css */

/* Light theme for sys-items */
[data-theme="light"] .sys-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ════════════════════════════════════════════════════════════
   ПРОФИЛЬ В НАСТРОЙКАХ — аватар + карточки
   ════════════════════════════════════════════════════════════ */

/* Баннер профиля — верхняя часть первой карточки */
.prof-id-card > div:first-child {
    border-radius: 14px 14px 0 0 !important;
}

/* Аватар-секция: аватар высовывает над баннером */
.prof-av-section {
    padding-top: 0 !important;
}
.prof-av-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 0 0 4px;
}
.prof-av-floating {
    margin-top: -34px !important;
    position: relative;
    z-index: 2;
}
.prof-av-floating img {
    border: 3px solid var(--bg-surface, #101422) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="light"] .prof-av-floating img {
    border-color: #fff !important;
}
.prof-av-text {
    flex: 1;
    min-width: 0;
    padding-bottom: 2px;
}
.prof-av-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prof-av-email {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: responsive profile */
@media (max-width: 600px) {
    .prof-av-floating img {
        border-width: 2px !important;
    }
    .prof-av-name {
        font-size: 0.95rem;
    }
}

/* ════════════════════════════════════════════════════════════
   АККАУНТЫ В НАСТРОЙКАХ — sacc-*
   ════════════════════════════════════════════════════════════ */

.sacc-card {
    margin-bottom: 14px;
    background: var(--glass-lg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease);
}

.sacc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 12px;
}
.sacc-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}
.sacc-header-text {
    flex: 1;
    min-width: 0;
}
.sacc-header-text span {
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--text-primary);
    display: block;
    letter-spacing: -0.01em;
}
.sacc-header-text small {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    margin-top: 1px;
}
.sacc-divider {
    height: 1px;
    background: var(--border-faint);
    margin: 0 16px;
}

/* ── Account rows ── */
.sacc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    transition: all 0.18s var(--ease);
    position: relative;
    border-radius: 0;
}
.sacc-row:active {
    background: var(--bg-active);
}
.sacc-row.sacc-active {
    background: color-mix(in srgb, var(--accent) 7%, transparent);
    border-left: 3px solid var(--accent);
    margin-left: 0;
    padding-left: 13px;
}
.sacc-row:hover {
    background: var(--bg-hover);
}

.sacc-av {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.92rem;
    color: #fff;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
    position: relative;
    transition: transform 0.22s var(--spring);
}
.sacc-row:hover .sacc-av {
    transform: scale(1.05);
}
.sacc-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sacc-av-check {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border: 2px solid var(--bg-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.45rem;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.22s var(--spring);
}
.sacc-row.sacc-active .sacc-av-check {
    opacity: 1;
    transform: scale(1);
}

.sacc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sacc-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sacc-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    width: fit-content;
}

.sacc-chevron {
    color: var(--text-muted);
    font-size: 0.65rem;
    opacity: 0.3;
    transition: all 0.2s var(--spring);
    flex-shrink: 0;
}
.sacc-row:hover .sacc-chevron {
    opacity: 0.6;
    transform: translateX(3px);
}

.sacc-rm {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.18s var(--ease);
    flex-shrink: 0;
    opacity: 0.4;
}
.sacc-row:hover .sacc-rm {
    opacity: 1;
}
.sacc-rm:hover {
    background: rgba(240, 70, 70, 0.12);
    color: var(--danger);
    opacity: 1;
}

/* ── Add account button ── */
.sacc-add-wrap {
    padding: 10px 16px 12px;
}
.sacc-add-btn {
    width: 100%;
    padding: 9px 14px;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.2s var(--ease);
}
.sacc-add-btn i {
    font-size: 0.72rem;
    opacity: 0.6;
    transition: transform 0.25s var(--spring);
}
.sacc-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.sacc-add-btn:hover i {
    transform: rotate(90deg);
    opacity: 1;
}
.sacc-add-btn:active {
    transform: scale(0.97);
}

/* ── Light theme ── */
[data-theme="light"] .sacc-card {
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .sacc-row:hover {
    background: rgba(0,0,0,0.03);
}
[data-theme="light"] .sacc-row.sacc-active {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
[data-theme="light"] .sacc-av-check {
    border-color: var(--bg-surface);
}
[data-theme="light"] .sacc-add-btn {
    border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .sacc-add-btn:hover {
    border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════
   FOLDER TABS
   ════════════════════════════════════════════════════════════ */
.folder-tabs-wrap { margin-bottom: 8px; }
.folder-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: thin; }
.folder-tab { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border-subtle); border-radius: 20px; background: var(--bg-input); font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; cursor: pointer; transition: all 0.15s var(--ease); }
.folder-tab:hover { border-color: var(--accent); color: var(--accent); }
.folder-tab.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.folder-tab i { font-size: 0.85rem; }
.folder-tab .close { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 0.65rem; color: var(--text-muted); background: transparent; border: none; cursor: pointer; transition: all 0.15s var(--ease); margin-left: 2px; }
.folder-tab .close:hover { background: var(--danger); color: #fff; border-radius: 50%; }

/* Modal wide */
.modal-card-wide { max-width: 720px; }
.modal-card-settings { width: 100%; max-width: 860px; }
.modal-body { padding: 1.5rem; max-height: 70vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border-faint); }

/* ════════════════════════════════════════════════════════════
   SETTINGS SIDEBAR — Icon Card Stack (PC)
   ════════════════════════════════════════════════════════════ */

.settings-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* ── Sidebar container ── */
.settings-sidebar {
    width: 262px;
    min-width: 262px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--accent) 6%, rgba(0,0,0,0.12)) 0%,
            rgba(0,0,0,0.05) 45%,
            transparent 100%
        );
    border-right: 1px solid var(--border-subtle);
}
.settings-sidebar::-webkit-scrollbar {
    width: 3px;
}
.settings-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

/* ── Sidebar groups — vertical stacks ── */
.settings-sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.settings-sidebar-group + .settings-sidebar-group {
    margin-top: 18px;
    padding-top: 4px;
    position: relative;
}

/* ── Group label ── */
.settings-sidebar-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 14px 6px;
    opacity: 0.4;
    user-select: none;
}

.settings-sidebar-spacer {
    flex: 1;
    min-height: 10px;
}

/* ── Tab items — flat rows with icon ── */
.settings-sidebar .settings-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 13px;
    padding: 0 14px 0 14px;
    height: 56px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 11px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.22s var(--ease), color 0.22s var(--ease),
        transform 0.2s var(--ease);
    text-align: left;
    width: 100%;
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Icon container */
.settings-sidebar .settings-tab i {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    font-size: 0.95rem;
    line-height: 1;
    text-align: center;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--accent) 7%, rgba(255,255,255,0.03));
    transition: all 0.22s var(--ease);
}

/* Hover — soft background, no border highlight */
.settings-sidebar .settings-tab:hover {
    background: color-mix(in srgb, var(--accent) 5%, rgba(255,255,255,0.03));
    color: var(--text-primary);
}
.settings-sidebar .settings-tab:hover i {
    color: var(--accent-light);
    background: color-mix(in srgb, var(--accent) 14%, rgba(255,255,255,0.04));
}

/* Active — gradient filled */
.settings-sidebar .settings-tab.active {
    background: linear-gradient(135deg,
        var(--accent) 0%,
        color-mix(in srgb, var(--accent) 82%, var(--accent-dark)) 100%
    );
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow:
        0 5px 16px color-mix(in srgb, var(--accent) 32%, transparent),
        inset 0 1px 0 rgba(255,255,255,0.22);
}
.settings-sidebar .settings-tab.active i {
    color: #fff;
    background: rgba(255,255,255,0.18);
}

/* ── Logout tab — как обычные кнопки, но красный ── */
.settings-tab-logout {
    color: color-mix(in srgb, var(--danger) 80%, var(--text-muted)) !important;
}
.settings-tab-logout i {
    color: color-mix(in srgb, var(--danger) 80%, var(--text-muted)) !important;
    background: color-mix(in srgb, var(--danger) 8%, transparent) !important;
}
.settings-tab-logout:hover {
    color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 5%, transparent) !important;
}
.settings-tab-logout:hover i {
    color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 14%, transparent) !important;
}
.settings-tab-logout.active {
    color: #fff !important;
    font-weight: 600 !important;
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%) !important;
    box-shadow: 0 5px 16px color-mix(in srgb, var(--danger) 32%, transparent), inset 0 1px 0 rgba(255,255,255,0.22) !important;
}
.settings-tab-logout.active i {
    color: #fff !important;
    background: rgba(255,255,255,0.18) !important;
}

/* ── Content area ── */
.settings-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background:
        radial-gradient(ellipse at 30% 0%, color-mix(in srgb, var(--accent) 2.5%, transparent) 0%, transparent 60%),
        var(--bg-primary);
}
.settings-content-scroll::-webkit-scrollbar {
    width: 4px;
}
.settings-content-scroll::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.settings-tab-content {
    display: none;
    animation: settingsFadeIn 0.3s var(--ease);
}
.settings-tab-content.active {
    display: block;
}

@keyframes settingsFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile navigation ── */
.settings-mobile-nav {
    display: none;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border-faint);
}

@media (max-width: 700px) {
    .settings-mobile-nav { display: block; }
    .settings-dropdown-overlay { display: none !important; }
    .settings-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 200;
        width: 290px;
        min-width: 290px;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: 0 0 60px rgba(0,0,0,0.5), 2px 0 20px rgba(0,0,0,0.3);
        background: var(--bg-island);
        padding: 24px 16px;
    }
    .settings-sidebar.open { transform: translateX(0); }
}

/* ── Dropdown (mobile) ── */
.settings-dropdown {
    position: relative;
}
.settings-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 13px;
    font: inherit;
    font-size: 1rem;
    font-weight: 540;
    color: var(--text-primary);
    cursor: pointer;
    gap: 12px;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s;
}
.settings-dropdown-btn:hover {
    border-color: var(--border-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.settings-dropdown-current {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.settings-dropdown-current i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    font-size: 0.95rem;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.settings-dropdown-current span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.settings-dropdown-arrow {
    transition: transform 0.25s var(--ease);
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.settings-dropdown-btn[aria-expanded="true"] .settings-dropdown-arrow { transform: rotate(180deg); }
.settings-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #0e1222;
    border: 1px solid var(--border-faint);
    border-radius: 13px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    z-index: 100;
    overflow: hidden;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.settings-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: settingsSlideDown 0.22s var(--ease);
}
.settings-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    background: transparent;
    border: none;
    border-radius: 9px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s var(--ease);
}
.settings-dropdown-item i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--accent) 7%, rgba(255,255,255,0.03));
    transition: all 0.15s var(--ease);
}
.settings-dropdown-item:hover {
    background: color-mix(in srgb, var(--accent) 7%, rgba(255,255,255,0.04));
}
.settings-dropdown-item:hover i {
    color: var(--accent-light);
    background: color-mix(in srgb, var(--accent) 14%, rgba(255,255,255,0.04));
}
.settings-dropdown-item.active {
    color: var(--accent-light);
    font-weight: 600;
    background: color-mix(in srgb, var(--accent) 11%, transparent);
}
.settings-dropdown-item.active i {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}
@keyframes settingsSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================================================================
   END SIDEBAR.CSS
   ================================================================== */

/* ════════════════════════════════════════════════════════════
   ТАБ-ФИЛЬТР ПО ПАПКАМ
   Все чаты | Название папки | ...
   ════════════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════════════
   ПАПКИ: UNDERLINE TAB BAR
   Левая часть: скроллабельные табы
   Правая часть: кнопка управления (фиксирована)
   ════════════════════════════════════════════════════════════ */

/* Внешний контейнер: flex, не скроллабельный.
   Не sticky и не поверх баннера — папки идут под sys-suggest-banner в потоке. */
.folder-tabs-wrap {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    flex-shrink: 0;
    background: var(--bg-surface, rgba(14, 18, 34, 0.96));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 0 0 12px 12px;
}

/* Скроллабельная часть — табы. Прозрачный фон, чёткая граница под баннером. */
.ftabs-scroll {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: transparent;
    border: none;
    box-shadow: none;
    position: relative;
}
.ftabs-scroll::-webkit-scrollbar {
    display: none;
}
.ftabs-scroll::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 26px;
    pointer-events: none;
    border-radius: 0 12px 12px 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ftabs-scroll.has-overflow::after {
    opacity: 1;
}
/* Перетаскивание как карусель — доступно только при переполнении */
.ftabs-scroll.has-overflow {
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.ftabs-scroll.has-overflow.dragging {
    cursor: grabbing;
}
.ftabs-scroll.dragging {
    scroll-behavior: auto !important;
}
[data-theme="light"] .ftabs-scroll::after {
    background: linear-gradient(90deg, transparent, rgba(247, 247, 251, 0.95));
}

/* Кнопка управления — фиксирована справа, не скроллится */
.ftab-manage {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.28);
    cursor: pointer;
    /* Тонкий левый разделитель */
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.82rem;
    transition:
        color 0.2s,
        background 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.ftab-manage:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.04);
}
.ftab-manage:active {
    opacity: 0.55;
}
/* Точка индикатора снизу (отсутствует — кнопка не является табом) */

/* Светлая тема */
[data-theme="light"] .folder-tabs-wrap {
    border-bottom-color: rgba(0, 0, 0, 0.09);
}
[data-theme="light"] .ftab-manage {
    color: rgba(0, 0, 0, 0.28);
    border-left-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .ftab-manage:hover {
    color: rgba(0, 0, 0, 0.65);
    background: rgba(0, 0, 0, 0.04);
}

/* Подпись таба — обрезается многоточием при нехватке ширины */
.ftab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Каждый таб: растягивается на всю ширину поровну, но не меньше минимума —
   если табов слишком много, полоса уходит в горизонтальный скролл */
.ftab {
    flex: 1 1 0;
    min-width: 112px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    /* Паддинг: больше снизу — там живёт индикатор */
    padding: 9px 14px 11px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.3);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.005em;
    transition: color 0.22s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

/* Индикатор: сложенный по умолчанию, развертывается при активации */
.ftab::after {
    content: "";
    position: absolute;
    bottom: -1px; /* Перекрывает границу полосы */
    left: 50%;
    right: 50%;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(
        90deg,
        var(--accent-dark),
        var(--accent),
        var(--accent-light)
    );
    box-shadow:
        0 0 10px rgba(139, 124, 246, 0.65),
        0 0 4px rgba(139, 124, 246, 0.4);
    transition:
        left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ftab:hover {
    color: rgba(255, 255, 255, 0.6);
}
.ftab:active {
    opacity: 0.7;
}

/* Иконка */
.ftab-ico {
    font-size: 0.64rem;
    opacity: 0.45;
    flex-shrink: 0;
    transition:
        opacity 0.22s,
        color 0.22s;
}
.ftab:hover .ftab-ico {
    opacity: 0.65;
}

/* Бейдж непрочитанных — маленькая точка вверху справа */
.ftab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.48rem;
    font-weight: 800;
    line-height: 1;
    margin-left: 2px;
    flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   АКТИВНЫЙ: белый текст, жирный, + глоу-индикатор развертывается
   ──────────────────────────────────────────────────────────── */
.ftab-active {
    color: var(--text-primary);
    font-weight: 600;
}
/* Индикатор развертывается от центра к краям */
.ftab-active::after {
    left: 12px;
    right: 12px;
}
.ftab-active .ftab-ico {
    opacity: 1;
    color: var(--accent);
}
/* Говер на активном — не теряем индикатор */
.ftab-active:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Мобиль */
@media (max-width: 768px) {
    .folder-tabs-wrap {
        padding: 0 6px;
    }
    .ftab {
        padding: 10px 16px 12px;
        font-size: 0.83rem;
        gap: 6px;
    }
    .ftab::after {
        height: 2.5px;
    }
    .ftab-active::after {
        left: 14px;
        right: 14px;
    }
    .ftab-ico {
        font-size: 0.68rem;
    }
    .ftab-badge {
        min-width: 17px;
        height: 17px;
        font-size: 0.5rem;
    }
}

/* Светлая тема — табы */
[data-theme="light"] .ftab {
    color: rgba(0, 0, 0, 0.28);
}
[data-theme="light"] .ftab:hover {
    color: rgba(0, 0, 0, 0.58);
}
[data-theme="light"] .ftab-active {
    color: rgba(0, 0, 0, 0.88);
    font-weight: 700;
}
[data-theme="light"] .ftab-active .ftab-ico {
    color: var(--accent-dark);
}
/* ── Mobile tab-bar (hidden on desktop) ── */
.mobile-tabbar {
    display: none;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE — Полноэкранный нативный сайдбар
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --nav-width: 0px;
        --sidebar-width: 100%;
    }

    /* ── Шапка мобильного сайдбара ── */
    .sidebar-header {
        padding: 16px 18px 10px;
        gap: 10px;
    }
    .sidebar-brand-icon {
        width: 36px; height: 36px;
        font-size: 0.88rem;
    }
    .sidebar-brand span {
        font-size: 1.2rem;
    }
    .sidebar-action-btn {
        display: flex;
        width: 38px; height: 38px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.06);
        color: var(--text-secondary);
        backdrop-filter: blur(8px);
    }
    .sidebar-action-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }
    .sidebar-action-btn:active {
        background: var(--accent);
        color: #fff;
        transform: scale(0.88);
    }

    /* ── Сам сайдбар ── */
    .modern-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: 100% !important;
        background: rgba(8, 10, 22, 0.92) !important;
        backdrop-filter: blur(40px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
        box-shadow: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        overflow: hidden !important;
    }
    .modern-sidebar::after,
    .modern-sidebar::before {
        display: none !important;
    }

    /* ── Область чата выезжает поверх ── */
    html.has-open-chat .modern-sidebar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .main-area {
        position: fixed !important;
        inset: 0;
        z-index: 200;
        opacity: 0;
        pointer-events: none;
        transform: translateX(100%);
        transition:
            transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
            opacity 0.28s ease;
        background: linear-gradient(180deg, rgba(5, 7, 17, 0.10), rgba(5, 7, 17, 0.26)) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .main-area.mobile-visible,
    html.has-open-chat .main-area {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    /* ── Поиск ── */
    .dsearch-new {
        display: none !important;
    }
    .sidebar-dsearch {
        padding: 0 16px 10px;
    }
    .dsearch-pill {
        height: 42px;
        border-radius: 21px;
        background: rgba(255, 255, 255, 0.07);
        backdrop-filter: blur(24px) saturate(200%);
        -webkit-backdrop-filter: blur(24px) saturate(200%);
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow: 0 1px 4px rgba(0,0,0,0.06), inset 0 0.5px 0.5px rgba(255,255,255,0.10);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .dsearch-pill:focus-within {
        background: rgba(255, 255, 255, 0.10);
        border-color: rgba(99, 102, 241, 0.35);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10), 0 2px 8px rgba(99, 102, 241, 0.06);
    }
    .dsearch-pill i {
        font-size: 0.85rem;
        opacity: 0.55;
    }
    .dsearch-pill input {
        font-size: 0.9rem;
        font-weight: 450;
        letter-spacing: -0.01em;
    }

    /* ── Табы ── */
    .sidebar-tabs {
        padding: 0 16px 10px;
        gap: 4px;
    }
    .sidebar-tab {
        padding: 8px 14px;
        font-size: 0.82rem;
        font-weight: 500;
        border-radius: 10px;
        transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .sidebar-tab:active {
        transform: scale(0.94);
    }
    .sidebar-tab span {
        display: inline !important;
    }
    .sidebar-tab i {
        display: inline !important;
        font-size: 0.82rem;
    }
    /* На мобиле прячем нижний индикатор — он уже читается через bg */
    .sidebar-tab::after {
        display: none !important;
    }

    /* ── Список ── */
    .sidebar-content {
        padding: 4px 0 8px;
        height: auto !important;
        flex: 1 !important;
        overflow-y: auto !important;
    }

    /* ── Элементы чата ── */
    .chat-item {
        padding: 14px 16px;
        gap: 14px;
        border-radius: 16px;
        margin-bottom: 0;
        position: relative;
        transition: background 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .chat-item::after {
        content: "";
        position: absolute;
        left: 76px;
        right: 0;
        bottom: 0;
        height: 1px;
        background: rgba(255, 255, 255, 0.04);
        pointer-events: none;
    }
    .chat-item:last-child::after {
        display: none;
    }
    .chat-item:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.04);
    }
    .chat-item:active {
        background: rgba(255, 255, 255, 0.07);
        transform: scale(0.97);
    }
    .chat-item.active {
        background: linear-gradient(135deg, rgba(124, 106, 224, 0.12), rgba(99, 102, 241, 0.08));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    .chat-item.active::after {
        display: none;
    }

    .chat-avatar {
        width: 50px;
        height: 50px;
        min-width: 50px;
        font-size: 1.05rem;
    }
    .chat-avatar.online::after {
        width: 12px;
        height: 12px;
        border-width: 2px;
    }
    .channel-avatar {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
    .chat-name {
        font-size: 0.95rem;
        font-weight: 590;
        letter-spacing: -0.02em;
        line-height: 1.25;
    }
    .chat-preview {
        font-size: 0.82rem;
        color: rgba(255, 255, 255, 0.35);
        line-height: 1.3;
    }
    .chat-time {
        font-size: 0.66rem;
        color: rgba(255, 255, 255, 0.28);
        font-weight: 500;
        letter-spacing: -0.01em;
    }
    .unread-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.6rem;
        border-radius: 50%;
        font-weight: 700;
        box-shadow: 0 2px 8px rgba(124, 106, 224, 0.35);
        background: linear-gradient(135deg, var(--accent), var(--accent-dark));
        color: #fff;
    }
    .chat-item-meta {
        gap: 6px;
    }

    /* ══════════════════════════════════════════════
     МОБИЛЬНЫЙ ТАБ-БАР (sidebar-dock скрыт на мобильных, работает только mobile-tabbar)
     ══════════════════════════════════════════════ */
    .sidebar-dock,
    .modern-sidebar .sidebar-dock {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        pointer-events: none !important;
    }

    /* ── Таб «Профиль» ── */
    .dock-profile {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        padding: 8px 4px !important;
        border-radius: 0 !important;
        min-width: 0 !important;
        position: relative;
    }
    .dock-profile:hover {
        background: rgba(255, 255, 255, 0.05) !important;
    }
    .dock-profile:active {
        background: rgba(255, 255, 255, 0.09) !important;
        transform: none !important;
    }

    /* Надпись «Профиль» через псевдоэлемент */
    .dock-profile::after {
        content: "Профиль";
        display: block;
        font-size: 0.56rem;
        font-weight: 600;
        color: var(--text-muted);
        line-height: 1;
        white-space: nowrap;
        transition: color 0.15s;
        font-family: inherit;
    }
    .dock-profile:hover::after {
        color: var(--text-secondary);
    }

    /* Аватар — компактный для таб-бара */
    .dock-avatar {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        font-size: 0.58rem !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
    }
    .dock-avatar::after {
        width: 7px !important;
        height: 7px !important;
        border-width: 1.5px !important;
        bottom: 0 !important;
        right: 0 !important;
    }

    /* Прячем текстовую инфу и стрелку — не нужны в таб-баре */
    .dock-info {
        display: none !important;
    }
    .dock-chevron {
        display: none !important;
    }
    .dock-actions {
        display: none !important;
    }
    .dock-btn .dock-label {
        display: none !important;
    }

    /* ── Группа кнопок — остальные табы ── */
    .dock-trailing {
        flex: 4 !important;
        display: flex !important;
        align-items: stretch !important;
        gap: 0 !important;
    }

    /* Каждая кнопка = полноценный таб */
    .dock-btn {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        height: 100% !important;
        width: auto !important;
        min-width: 0 !important;
        border-radius: 0 !important;
        padding: 8px 2px !important;
        font-size: 0.9rem !important;
        color: var(--text-muted);
        position: relative;
    }
    .dock-btn:hover {
        background: rgba(255, 255, 255, 0.05) !important;
    }
    .dock-btn:active {
        background: rgba(255, 255, 255, 0.09) !important;
        transform: none !important;
    }
    .dock-btn i {
        transition: color 0.15s !important;
    }
    /* На таб-баре иконка не масштабируется при ховере */
    .dock-btn:hover i {
        transform: none !important;
        color: var(--text-secondary) !important;
    }

    /* ── Подписи к табам (только мобиль) ── */
    #nav-archive::after {
        content: "Архив";
        display: block;
        font-size: 0.55rem;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        font-family: inherit;
    }
    #nav-saved::after {
        content: "Избранное";
        display: block;
        font-size: 0.55rem;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        font-family: inherit;
    }
    #nav-folders::after {
        content: "Папки";
        display: block;
        font-size: 0.55rem;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        font-family: inherit;
    }
    #nav-settings::after {
        content: "Настройки";
        display: block;
        font-size: 0.55rem;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        font-family: inherit;
    }

    /* Бэдж архива — смещаем вправо от иконки */
    .dock-badge {
        position: absolute !important;
        top: 6px !important;
        right: auto !important;
        left: calc(50% + 5px) !important;
        width: 8px !important;
        height: 8px !important;
    }

    /* ── Топбар чата ── */
    .chat-topbar {
        padding: 0 14px;
        height: 60px;
        background: linear-gradient(
            180deg,
            rgba(14, 18, 28, 0.97) 0%,
            rgba(14, 18, 28, 0.92) 100%
        );
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-faint);
    }
    .chat-back-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1.1rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-faint);
    }
    .chat-back-btn:active {
        transform: scale(0.9);
    }
    .partner-avatar {
        width: 40px;
        height: 40px;
    }
    .partner-info h3 {
        font-size: 0.95rem;
    }
    .partner-status {
        font-size: 0.76rem;
    }
    .topbar-actions .btn-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--border-faint);
    }
    .topbar-actions .btn-icon:active {
        transform: scale(0.9);
    }
    .topbar-actions .btn-icon:not(#chat-info-btn) {
        display: none;
    }

    /* ── Сообщения ── */
    .messages-container {
        padding: 10px;
    }
    .message-wrapper {
        max-width: 80%;
    }
    .message-bubble {
        padding: 10px 14px;
        font-size: 0.95rem;
        border-radius: 22px;
    }
    .message-wrapper.sent .message-bubble {
        border-bottom-right-radius: 7px;
    }
    .message-wrapper.received .message-bubble {
        border-bottom-left-radius: 7px;
    }

    /* ── Компоузер ── */
    .composer {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 6px;
        align-items: flex-end;
    }
    .input-wrapper {
        border-radius: 24px;
        padding: 0 6px;
        display: flex;
        align-items: center;
        min-height: 44px;
        box-sizing: border-box;
    }
    .input-wrapper textarea {
        font-size: 0.95rem;
        padding: 0.55rem 4px;
        line-height: 1.35;
        margin: 0;
        align-self: center;
        box-sizing: border-box;
    }
    .composer-inner-btn {
        margin: 0;
        align-self: center;
        height: 44px;
        min-height: 44px;
    }
    .composer-send-wrapper {
        width: 44px;
        height: 44px;
        margin: 0;
        align-self: flex-end;
    }
    .send-btn,
    .mic-inline {
        width: 44px;
        height: 44px;
    }

    /* ── Запись ── */
    .recording-bar {
        padding: 6px 8px;
    }
    .rec-bar-cancel,
    .rec-bar-send {
        width: 40px;
        height: 40px;
    }

    /* ── Reply ── */
    .reply-bar {
        padding: 10px 14px;
    }

    /* ── Закреплённое ── */
    .pinned-banner {
        padding: 10px 16px;
    }

    /* ── Модалки (выезжают снизу на мобиле) ── */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0;
        max-height: 88vh;
    }
    .modal-card-wide {
        width: 100% !important;
    }
    .modal-header {
        padding: 16px 18px 12px;
    }
    .modal-body {
        padding: 14px 18px;
    }
    .modal-footer {
        padding: 10px 18px 20px;
    }

    /* ── Эмодзи панель ── */
    .emoji-panel {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 20px 20px 0 0 !important;
    }
    .emoji-panel.active {
        bottom: 0 !important;
    }
    .emoji-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    .emoji-grid span {
        font-size: 1.4rem;
        padding: 6px;
    }
    .sticker-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .sticker-grid-wrapper {
        max-height: 240px;
    }
    .sticker-packs-bar {
        gap: 4px;
    }

    /* ── Контекстное меню ── */
    .context-menu {
        min-width: 210px;
        border-radius: 22px;
        padding: 8px;
    }
    .context-menu-item {
        padding: 11px 10px;
        font-size: 0.92rem;
        border-radius: 15px;
        gap: 12px;
    }
    .context-menu-item i {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    .ctx-reaction-btn,
    .ctx-reaction-full-btn {
        height: 46px;
    }

    /* ── Авторизация ── */
    .auth-card {
        flex-direction: column;
        min-height: 100vh;
        border-radius: 0;
    }
    .auth-left {
        display: none;
    }
    .auth-right {
        width: 100%;
        padding: 2.5rem 1.5rem;
    }

    /* ── Пустой экран ── */
    .empty-wavatar {
        width: 72px;
        height: 72px;
    }
    .empty-wav {
        width: 72px;
        height: 72px;
        font-size: 1.6rem;
    }
    .empty-wav i {
        font-size: 1.6rem;
    }
    .empty-wh1 {
        font-size: 1.4rem;
    }
    .empty-wp {
        font-size: 0.82rem;
    }
    .empty-wbtn {
        padding: 10px 14px;
    }
    .empty-wacts {
        max-width: 92%;
    }

    /* ── Медиа ── */
    .media-wrap {
        max-width: 82vw;
    }
    .media-sticker img {
        width: 110px;
        height: 110px;
    }
    .message-voice {
        min-width: 175px;
    }
    .media-file {
        min-width: 160px;
    }

    /* ── Настройки ── */
    .modal-card-settings {
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    .settings-layout {
        flex-direction: column;
    }
    .settings-sidebar {
        display: none;
    }
    .settings-mobile-nav {
        display: block !important;
        padding: 12px 16px;
    }
    .settings-content-scroll {
        padding: 12px 16px;
    }

    /* ── Scroll hint ── */
    .scroll-bottom-hint {
        bottom: 70px;
        right: 14px;
    }

    /* ══════════════════════════════════════════════════════════
       ФИНАЛЬНЫЙ OVERRIDE: скрыть старый dock + верхние табы,
       показать новый мобильный таб-бар
       ══════════════════════════════════════════════════════════ */
    .sidebar-tabs {
        display: none !important;
    }
    .sidebar-dock {
        display: none !important;
    }

    /* ══════════════════════════════════════════════════════════
       FLOATING GLASS PILL TAB BAR — refined design
    ══════════════════════════════════════════════════════════ */
    .mobile-tabbar {
        display: flex !important;
        align-items: center;
        margin: 0 12px calc(8px + env(safe-area-inset-bottom, 0px));
        padding: 6px;
        border-radius: 26px;
        min-height: 62px;
        border-top: none !important;

        background: rgba(11, 13, 26, 0.82) !important;
        backdrop-filter: blur(40px) saturate(180%) brightness(1.08) !important;
        -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.08) !important;

        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow:
            0 20px 56px rgba(0, 0, 0, 0.55),
            0 8px 24px rgba(0, 0, 0, 0.35),
            0 4px 32px rgba(139, 124, 246, 0.16),
            inset 0 1px 0 rgba(255, 255, 255, 0.12),
            inset 0 -1px 0 rgba(0, 0, 0, 0.12) !important;

        background-image: radial-gradient(
            ellipse 80% 100% at 50% 0%,
            rgba(139, 124, 246, 0.08) 0%,
            transparent 60%
        ) !important;

        flex-shrink: 0;
        position: relative;
        z-index: 10;
        animation: tabbarFloat 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    }
    @keyframes tabbarFloat {
        from { opacity: 0; transform: translateY(30px) scale(0.92); }
        to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    .mobile-tabbar::before {
        content: "";
        position: absolute;
        top: 0;
        left: 15%;
        right: 15%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
        border-radius: 1px;
        pointer-events: none;
    }

    /* ── Tab buttons ── */
    .mbt-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: none;
        background: transparent;
        color: rgba(255, 255, 255, 0.34);
        font-family: inherit;
        font-size: 0.52rem;
        font-weight: 600;
        cursor: pointer;
        padding: 8px 6px;
        border-radius: 20px;
        position: relative;
        letter-spacing: 0.01em;
        transition:
            background 0.25s var(--ease),
            color 0.25s var(--ease),
            box-shadow 0.25s var(--ease);
        -webkit-tap-highlight-color: transparent;
    }
    .mbt-btn i {
        font-size: 1.25rem;
        display: block;
        position: relative;
        z-index: 1;
        transition:
            color 0.25s var(--ease),
            transform 0.3s var(--spring),
            filter 0.3s var(--ease);
    }
    .mbt-btn span {
        display: block;
        line-height: 1;
        white-space: nowrap;
        position: relative;
        z-index: 1;
        transition: color 0.25s var(--ease);
    }

    .mbt-btn:active {
        transform: scale(0.93);
    }
    .mbt-btn:active i {
        transform: scale(0.88);
    }

    /* ── Active tab: glowing pill ── */
    .mbt-btn.mbt-active {
        color: #fff;
        background: linear-gradient(145deg,
            rgba(139, 124, 246, 0.28) 0%,
            rgba(116, 101, 212, 0.16) 100%);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.12),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1),
            0 3px 12px rgba(139, 124, 246, 0.28),
            0 0 0 1px rgba(139, 124, 246, 0.18);
    }
    .mbt-btn.mbt-active i {
        color: var(--accent-light, #b4a4fc);
        transform: scale(1.08);
        filter: drop-shadow(0 0 6px rgba(139, 124, 246, 0.55));
    }
    .mbt-btn.mbt-active span {
        color: rgba(255, 255, 255, 0.82);
    }
    .mbt-btn.mbt-active::before {
        display: none;
    }

    /* ── Avatar (settings tab) ── */
    .mbt-av {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--accent), var(--blue));
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.58rem;
        font-weight: 700;
        color: #fff;
        overflow: hidden;
        transition:
            transform 0.3s var(--spring),
            box-shadow 0.25s var(--ease);
        flex-shrink: 0;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.16),
            0 2px 8px rgba(139, 124, 246, 0.3);
        position: relative;
        z-index: 1;
    }
    .mbt-av::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.25), transparent 55%);
        pointer-events: none;
    }
    .mbt-av img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
    }
    .mbt-btn:active .mbt-av {
        transform: scale(0.85);
    }
    .mbt-btn.mbt-active .mbt-av {
        transform: scale(1.1);
        box-shadow:
            0 0 0 2px rgba(255, 255, 255, 0.5),
            0 0 0 4px rgba(139, 124, 246, 0.35),
            0 3px 12px rgba(139, 124, 246, 0.45);
    }

    /* ── Light theme ── */
    [data-theme="light"] .mobile-tabbar {
        background: rgba(240, 242, 255, 0.82) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow:
            0 18px 48px rgba(0, 0, 0, 0.12),
            0 6px 20px rgba(0, 0, 0, 0.07),
            0 3px 24px rgba(139, 124, 246, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.8),
            inset 0 -1px 0 rgba(0, 0, 0, 0.04) !important;
        background-image: radial-gradient(
            ellipse 80% 100% at 50% 0%,
            rgba(139, 124, 246, 0.05) 0%,
            transparent 60%
        ) !important;
    }
    [data-theme="light"] .mobile-tabbar::before {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
    }
    [data-theme="light"] .mbt-btn {
        color: rgba(0, 0, 0, 0.3);
    }
    [data-theme="light"] .mbt-btn.mbt-active {
        background: linear-gradient(145deg,
            rgba(139, 124, 246, 0.14) 0%,
            rgba(116, 101, 212, 0.08) 100%);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.6),
            0 2px 8px rgba(139, 124, 246, 0.14),
            0 0 0 1px rgba(139, 124, 246, 0.12);
        color: var(--accent-dark);
    }
    [data-theme="light"] .mbt-btn.mbt-active i {
        color: var(--accent-dark);
        filter: drop-shadow(0 0 4px rgba(139, 124, 246, 0.35));
    }
    [data-theme="light"] .mbt-btn.mbt-active span {
        color: var(--accent-dark);
    }
}

/* ── Очень маленькие телефоны (< 380px) ── */
@media (max-width: 380px) {
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    .sticker-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .sticker-pack-btn {
        width: 32px;
        height: 32px;
    }
    .context-menu {
        border-radius: 22px;
        padding: 8px;
    }
    .message-wrapper {
        max-width: 84%;
    }
    .modal-card {
        border-radius: 20px 20px 0 0;
    }
}

/* ══════════════════════════════════════════════════════════════
   СВЕТЛАЯ ТЕМА
   ══════════════════════════════════════════════════════════════ */
[data-theme="light"] .modern-sidebar {
    background: rgba(247, 249, 254, 0.85) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.07) !important;
}
[data-theme="light"] .dsearch-pill {
    background: rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), inset 0 0.5px 0.5px rgba(255,255,255,0.5);
}
[data-theme="light"] .dsearch-pill:focus-within {
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 2px 8px rgba(99, 102, 241, 0.06);
}
[data-theme="light"] .sidebar-tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--accent-dark);
    font-weight: 700;
}
[data-theme="light"] .chat-item:hover {
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .chat-item.active {
    background: rgba(139, 124, 246, 0.09);
}
[data-theme="light"] .chat-item.active .chat-name {
    color: var(--accent-dark);
}
[data-theme="light"] .chat-avatar.online::after {
    border-color: rgba(247, 249, 254, 0.98);
}
[data-theme="light"] .sidebar-dock {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
[data-theme="light"] .dock-avatar::after {
    border-color: var(--bg-surface);
}
[data-theme="light"] .dock-action {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .dock-action:hover {
    color: rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .sys-suggest-banner {
    background-color: rgba(247, 249, 254, 0.92);
}
[data-theme="light"] .dock-avatar::after {
    border-color: var(--bg-surface);
}

@media (max-width: 768px) {
    [data-theme="light"] .modern-sidebar {
        background: rgba(244, 246, 252, 0.92) !important;
        backdrop-filter: blur(40px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
        box-shadow: none !important;
        border-right: none !important;
    }
    [data-theme="light"] .chat-topbar {
        background: rgba(244, 246, 252, 0.97);
        border-bottom-color: rgba(0, 0, 0, 0.07);
    }
    [data-theme="light"] .composer {
        background: rgba(250, 251, 253, 0.95);
        border-top-color: rgba(0, 0, 0, 0.06);
    }
    /* Таб-бар в светлой теме */
    [data-theme="light"] .sidebar-dock {
        border-top-color: var(--border-medium) !important;
        border-radius: 0 !important;
    }
    [data-theme="light"] .dock-profile:hover {
        background: rgba(0, 0, 0, 0.04) !important;
    }
    [data-theme="light"] .dock-profile:active {
        background: rgba(0, 0, 0, 0.07) !important;
    }
    [data-theme="light"] .dock-btn:hover {
        background: rgba(0, 0, 0, 0.04) !important;
    }
    [data-theme="light"] .dock-btn:active {
        background: rgba(0, 0, 0, 0.07) !important;
    }
    [data-theme="light"] .dock-avatar::after {
        border-color: var(--bg-surface) !important;
    }
    /* Шапка мобильного сайдбара */
    [data-theme="light"] .sidebar-header {
        background: transparent;
    }
    [data-theme="light"] .sidebar-action-btn {
        background: rgba(0, 0, 0, 0.05);
        color: #666;
        border: none;
    }
    [data-theme="light"] .sidebar-action-btn:active {
        background: var(--accent);
        color: #fff;
    }
    [data-theme="light"] .chat-item::after {
        background: rgba(0, 0, 0, 0.04);
    }
    [data-theme="light"] .chat-item:active {
        background: rgba(0, 0, 0, 0.06);
    }
    [data-theme="light"] .chat-item.active {
        background: rgba(139, 124, 246, 0.1);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    [data-theme="light"] .chat-preview {
        color: rgba(0, 0, 0, 0.3);
    }
    [data-theme="light"] .chat-time {
        color: rgba(0, 0, 0, 0.25);
    }
}

/* ── Status Emoji Picker ── */
.status-emoji-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
#status-emoji-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-faint);
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
    flex-shrink: 0;
}
#status-emoji-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
#status-emoji-btn.active {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: var(--accent);
}
#status-emoji-display {
    font-size: 1.3rem;
    line-height: 1;
    min-width: 24px;
    text-align: center;
}
#status-emoji-picker {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-faint);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.15);
    padding: 10px;
    z-index: 1000;
    min-width: 260px;
}
.emoji-picker-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    padding: 0 2px;
}
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.emoji-opt {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s var(--ease);
}
.emoji-opt:hover {
    background: var(--bg-hover);
}
.emoji-opt-sel {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.emoji-opt-none {
    font-size: 0.85rem;
    color: var(--text-muted);
}
[data-theme="light"] #status-emoji-picker {
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

/* ══════════════════════════════════════════════════════════
   GUARANTEED DESKTOP DOCK ENGINE (PC > 768px)
   ══════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════
   GUARANTEED DESKTOP DOCK ENGINE (PC > 768px)
   ══════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════
   GUARANTEED DESKTOP DOCK ENGINE (PC > 768px)
   ══════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
    html.has-open-chat .modern-sidebar,
    .modern-sidebar {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        height: calc(100vh - 24px) !important;
        max-height: calc(100vh - 24px) !important;
        margin: 12px 10px 12px 12px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .modern-sidebar > .sidebar-header,
    .modern-sidebar > .sidebar-dsearch,
    .modern-sidebar > .sidebar-tabs,
    .modern-sidebar > .sidebar-notif {
        flex: 0 0 auto !important;
    }

    .modern-sidebar > .sidebar-content {
        flex: 1 1 0% !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: calc(100% - 120px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    html.has-open-chat .modern-sidebar,
    .modern-sidebar {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        height: calc(100vh - 24px) !important;
        max-height: calc(100vh - 24px) !important;
        margin: 12px 10px 12px 12px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .modern-sidebar > .sidebar-header,
    .modern-sidebar > .sidebar-dsearch,
    .modern-sidebar > .sidebar-tabs,
    .modern-sidebar > .sidebar-notif {
        flex: 0 0 auto !important;
    }

    .modern-sidebar > .sidebar-content {
        flex: 1 1 0% !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: calc(100% - 120px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .sidebar-dock,
    .modern-sidebar > .sidebar-dock,
    .modern-sidebar .sidebar-dock,
    html.has-open-chat .sidebar-dock,
    html.has-open-chat .modern-sidebar .sidebar-dock {
        flex: 0 0 auto !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        margin-top: auto !important;
        padding: 12px 14px 14px !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        position: relative !important;
        z-index: 50 !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        justify-content: normal !important;
        box-sizing: border-box !important;
    }

    .dock-profile,
    .modern-sidebar .dock-profile {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 6px 6px 6px 6px !important;
        border-radius: 24px !important;
        background: transparent !important;
        border: none !important;
        flex: 1 !important;
        min-width: 0 !important;
        height: auto !important;
        cursor: pointer !important;
    }
    .dock-profile:hover {
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .dock-profile::after {
        display: none !important;
        content: none !important;
    }

    .dock-avatar,
    .modern-sidebar .dock-avatar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 0.65rem !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        border-radius: 50% !important;
        background-color: var(--accent, #6366f1);
        background-size: cover;
        background-position: center;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
        position: relative !important;
        flex-shrink: 0 !important;
    }

    .dock-avatar:not([style*="background-image"]) {
        background-image: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(168, 85, 247, 0.9) 100%);
    }

    .dock-info,
    .modern-sidebar .dock-info {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-direction: column !important;
        justify-content: center !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    .dock-name,
    .modern-sidebar .dock-name {
        color: var(--text-primary, rgba(255, 255, 255, 0.95)) !important;
        font-weight: 600 !important;
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        letter-spacing: -0.01em !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .dock-status,
    .modern-sidebar .dock-status {
        color: var(--green, #34d399) !important;
        font-weight: 500 !important;
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        opacity: 0.9 !important;
    }

    .dock-chevron,
    .modern-sidebar .dock-chevron {
        display: flex !important;
        visibility: visible !important;
        opacity: 0.15 !important;
        font-size: 0.4rem !important;
        transition: none !important;
        width: 12px !important;
        height: 12px !important;
    }
    .dock-profile:hover .dock-chevron {
        opacity: 0.15 !important;
        transform: none !important;
    }

    .dock-actions,
    .modern-sidebar .dock-actions {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center !important;
        gap: 2px !important;
        padding-left: 8px !important;
        border-left: 1px solid rgba(255, 255, 255, 0.04) !important;
        flex-shrink: 0 !important;
    }

    .dock-action,
    .modern-sidebar .dock-action {
        display: inline-flex;
        visibility: visible;
        opacity: 1;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.3);
        font-size: 0.9rem;
        transition: color 0.15s ease;
        cursor: pointer;
        flex-shrink: 0;
    }
    .dock-action:hover {
        background: transparent !important;
        border-color: transparent !important;
        color: rgba(255, 255, 255, 0.5) !important;
        transform: none !important;
        box-shadow: none !important;
    }
    .dock-action:active {
        transform: none !important;
    }
    #dock-admin {
        color: rgba(255, 255, 255, 0.3) !important;
        background: transparent !important;
        border: none !important;
    }
    #dock-admin:hover {
        background: transparent !important;
        border-color: transparent !important;
        color: rgba(255, 255, 255, 0.5) !important;
        box-shadow: none !important;
    }
    .dock-action[style*="display: none"],
    .dock-action[style*="display:none"],
    .modern-sidebar .dock-action[style*="display: none"],
    .modern-sidebar .dock-action[style*="display:none"] {
        display: none !important;
    }

    .dock-trailing,
    .modern-sidebar .dock-trailing {
        display: none !important;
    }
}
