/* XSSM Mobile Inbox  */

.sidebar-brand-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.mobile-brand-label,
.sidebar-brand-summary,
.mobile-chats-heading,
.mbt-unread {
    display: none;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-read-btn {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --mobile-inbox-pad: clamp(12px, 3.8vw, 17px);
        --mobile-inbox-accent: #9b87f5;
        --mobile-inbox-accent-soft: rgba(155, 135, 245, 0.14);
        --mobile-inbox-line: rgba(255, 255, 255, 0.055);
        --mobile-inbox-surface: rgba(13, 16, 30, 0.48);
    }

    body.messenger-body {
        overscroll-behavior: none;
    }

    .modern-sidebar,
    html:not(.has-open-chat) .modern-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background:
            linear-gradient(180deg, rgba(5, 7, 17, 0.08), rgba(5, 7, 17, 0.22) 65%, rgba(5, 7, 17, 0.34)) !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    .modern-sidebar::before {
        content: "" !important;
        position: absolute !important;
        z-index: 0 !important;
        top: -130px !important;
        right: -120px !important;
        display: block !important;
        width: 310px !important;
        height: 310px !important;
        border-radius: 50% !important;
        background: rgba(113, 88, 221, 0.08) !important;
        filter: blur(55px) !important;
        pointer-events: none !important;
    }

    /* ── Header ───────────────────────────────────────────── */
    .modern-sidebar > .sidebar-header {
        display: flex;
        min-height: 76px;
        flex: 0 0 auto;
        align-items: center;
        gap: 10px;
        padding:
            calc(9px + env(safe-area-inset-top, 0px))
            var(--mobile-inbox-pad)
            8px;
        background: linear-gradient(180deg, rgba(7, 9, 20, 0.22), transparent);
    }

    .sidebar-brand {
        display: flex;
        min-width: 0;
        flex: 1;
        align-items: center;
        gap: 11px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        cursor: default;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .sidebar-brand:hover,
    .sidebar-brand:active {
        transform: none;
        border-color: transparent;
        background: transparent;
        box-shadow: none;
    }

    .sidebar-brand-icon {
        position: relative;
        display: grid;
        width: 42px;
        height: 42px;
        flex: 0 0 auto;
        place-items: center;
        border: 1px solid rgba(206, 193, 255, 0.2);
        border-radius: 15px;
        background:
            linear-gradient(145deg, rgba(169, 143, 255, 0.35), rgba(83, 66, 170, 0.13)),
            rgba(255, 255, 255, 0.025);
        color: rgba(246, 243, 255, 0.94);
        box-shadow:
            0 10px 27px rgba(62, 41, 148, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.16);
        font-size: 0.82rem;
    }

    .sidebar-brand-icon::after {
        content: "";
        position: absolute;
        top: 5px;
        right: 5px;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #72ddb0;
        box-shadow: 0 0 8px rgba(84, 222, 164, 0.65);
    }

    .sidebar-brand-copy {
        justify-content: center;
    }

    .sidebar-brand .sidebar-brand-title {
        display: block;
        overflow: hidden;
        color: rgba(250, 249, 255, 0.96);
        font-size: 1.28rem;
        font-weight: 790;
        letter-spacing: -0.045em;
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .desktop-brand-label {
        display: none;
    }

    .sidebar-brand .mobile-brand-label {
        display: inline;
        color: inherit;
        font: inherit;
        letter-spacing: inherit;
    }

    .sidebar-brand-summary {
        display: block;
        overflow: hidden;
        margin-top: 4px;
        color: rgba(191, 187, 210, 0.48);
        font-size: 0.58rem;
        font-weight: 570;
        letter-spacing: 0;
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-brand-summary.has-unread {
        color: rgba(187, 170, 255, 0.72);
    }

    .sidebar-header-actions {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 7px;
    }

    .sidebar-header-actions .sidebar-action-btn {
        position: relative;
        display: grid;
        width: 40px;
        height: 40px;
        flex: 0 0 auto;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.075);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.035);
        color: rgba(216, 212, 232, 0.62);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
        font-size: 0.71rem;
        -webkit-backdrop-filter: blur(18px) saturate(135%);
        backdrop-filter: blur(18px) saturate(135%);
        transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
    }

    .sidebar-header-actions .sidebar-action-btn:active {
        transform: scale(0.91);
    }

    .sidebar-header-actions .sidebar-compose-btn {
        border-color: rgba(186, 167, 255, 0.2);
        background: linear-gradient(145deg, rgba(151, 123, 239, 0.25), rgba(91, 72, 184, 0.1));
        color: rgba(244, 240, 255, 0.95);
        box-shadow:
            0 8px 20px rgba(64, 44, 147, 0.16),
            inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }

    .sidebar-header-actions .sidebar-read-btn {
        display: grid;
    }

    .modern-sidebar[data-mobile-panel="contacts"] .sidebar-read-btn {
        display: none;
    }

    .sidebar-read-btn.no-unread {
        opacity: 0.42;
        pointer-events: none;
    }

    .sidebar-action-dot {
        position: absolute;
        top: 7px;
        right: 7px;
        width: 6px;
        height: 6px;
        border: 1.5px solid rgba(12, 14, 25, 0.92);
        border-radius: 50%;
        background: #a78bfa;
        box-shadow: 0 0 7px rgba(167, 139, 250, 0.55);
    }

    .sidebar-read-btn.no-unread .sidebar-action-dot {
        display: none;
    }

    /* ── Search ───────────────────────────────────────────── */
    .modern-sidebar > .sidebar-dsearch {
        display: block;
        flex: 0 0 auto;
        padding: 4px var(--mobile-inbox-pad) 11px;
    }

    .modern-sidebar .dsearch-new {
        display: none !important;
    }

    .modern-sidebar .dsearch-pill {
        height: 45px;
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.075);
        border-radius: 16px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
            rgba(8, 10, 21, 0.38);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.045),
            0 7px 20px rgba(2, 4, 12, 0.08);
        -webkit-backdrop-filter: blur(24px) saturate(145%);
        backdrop-filter: blur(24px) saturate(145%);
    }

    .modern-sidebar .dsearch-pill:focus-within {
        border-color: rgba(157, 134, 244, 0.3);
        background: rgba(14, 16, 31, 0.72);
        box-shadow:
            0 0 0 3px rgba(145, 120, 233, 0.065),
            inset 0 1px 0 rgba(255, 255, 255, 0.055);
    }

    .modern-sidebar .dsearch-icon {
        width: 42px;
        color: rgba(192, 187, 210, 0.45);
    }

    .modern-sidebar .dsearch-icon i,
    .modern-sidebar .dsearch-pill i {
        font-size: 0.7rem;
        opacity: 1;
    }

    .modern-sidebar .dsearch-field input {
        height: 43px;
        padding: 0;
        color: rgba(243, 241, 250, 0.9);
        font-size: 0.76rem;
        font-weight: 560;
        letter-spacing: -0.01em;
    }

    .modern-sidebar .dsearch-field input::placeholder {
        color: rgba(179, 174, 198, 0.4);
    }

    .modern-sidebar .dsearch-clear {
        width: 34px;
        height: 34px;
        margin-right: 4px;
        border-radius: 11px;
        color: rgba(203, 198, 219, 0.5);
    }

    /* ── Scrollable inbox ─────────────────────────────────── */
    .modern-sidebar > .sidebar-content {
        position: relative;
        flex: 1 1 0% !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 0 0 12px !important;
        scroll-padding-bottom: 18px;
        scrollbar-width: none;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .modern-sidebar > .sidebar-content::-webkit-scrollbar {
        display: none;
    }

    .sidebar-search-results {
        margin: 0 var(--mobile-inbox-pad);
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 19px;
        background: rgba(9, 12, 24, 0.82);
        box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
        -webkit-backdrop-filter: blur(30px) saturate(150%);
        backdrop-filter: blur(30px) saturate(150%);
    }

    /* Folder filter chips */
    .folder-tabs-wrap {
        margin: 0;
        padding: 1px var(--mobile-inbox-pad) 10px;
        gap: 7px;
        scrollbar-width: none;
    }

    .folder-tabs-wrap::-webkit-scrollbar {
        display: none;
    }

    .folder-tabs-wrap .ftab {
        flex: 1 1 0;
        min-width: 84px;
        min-height: 34px;
        padding: 0 12px;
        border: 1px solid rgba(255, 255, 255, 0.055);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.018);
        color: rgba(197, 192, 215, 0.5);
        font-size: 0.57rem;
        font-weight: 650;
    }

    .folder-tabs-wrap .ftab-active {
        border-color: rgba(165, 141, 249, 0.18);
        background: rgba(144, 116, 232, 0.12);
        color: rgba(235, 230, 251, 0.86);
    }

    .folder-tabs-wrap .ftab::after {
        display: none;
    }

    /* Compact system shortcuts */
    .sidebar-sys-items {
        display: grid;
        grid-template-columns: minmax(0, 1.62fr) minmax(96px, 0.75fr);
        gap: 8px;
        padding: 0 var(--mobile-inbox-pad) 10px;
    }

    .sidebar-sys-items .sys-suggest-banner {
        min-width: 0;
        min-height: 68px;
        margin: 0;
        padding: 10px 9px 10px 10px;
        border-radius: 18px;
    }

    .sidebar-sys-items .sys-suggest-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 12px;
        font-size: 0.72rem;
    }

    .sidebar-sys-items .sys-suggest-kicker,
    .sidebar-sys-items .sys-suggest-time {
        display: none;
    }

    .sidebar-sys-items .sys-suggest-title {
        font-size: 0.66rem;
    }

    .sidebar-sys-items .sys-suggest-sub {
        margin-top: 4px;
        font-size: 0.53rem;
    }

    .sidebar-sys-items .sys-suggest-close {
        top: 4px;
        right: 4px;
        width: 21px;
        height: 21px;
    }

    .sidebar-sys-items .sys-item {
        min-width: 0;
        min-height: 68px;
        gap: 8px;
        margin: 0;
        padding: 9px;
        border: 1px solid rgba(255, 255, 255, 0.065);
        border-radius: 18px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.008)),
            rgba(8, 10, 21, 0.25);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    }

    .sidebar-sys-items .sys-saved {
        display: flex;
    }

    .sidebar-sys-items .sys-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 12px;
        font-size: 0.67rem;
    }

    .sidebar-sys-items .sys-name {
        font-size: 0.65rem;
    }

    .sidebar-sys-items .sys-sub {
        display: none;
    }

    .sidebar-sys-items .sys-archive {
        grid-column: 1 / -1;
    }

    .sidebar-sys-items .sys-archive:not(.sys-arch-shown) {
        min-height: 0 !important;
        border-width: 0;
    }

    .sidebar-sys-items .sys-archive.sys-arch-shown {
        min-height: 54px;
        padding: 8px 10px !important;
    }

    .pull-hint {
        width: calc(100% - (var(--mobile-inbox-pad) * 2));
        margin: 0 var(--mobile-inbox-pad);
        border-radius: 14px;
        color: rgba(183, 171, 227, 0.55);
        font-size: 0.54rem;
    }

    /* List heading */
    .mobile-chats-heading {
        display: flex;
        min-height: 38px;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 2px var(--mobile-inbox-pad) 6px;
    }

    .mobile-chats-heading-copy {
        display: flex;
        min-width: 0;
        align-items: baseline;
        gap: 7px;
    }

    .mobile-chats-heading-copy > span {
        color: rgba(237, 234, 246, 0.78);
        font-size: 0.72rem;
        font-weight: 760;
        letter-spacing: -0.015em;
    }

    .mobile-chats-heading-copy > small {
        color: rgba(170, 166, 188, 0.38);
        font-size: 0.5rem;
        font-weight: 600;
    }

    .mobile-folder-shortcut {
        display: inline-flex;
        min-height: 30px;
        align-items: center;
        gap: 5px;
        padding: 0 9px;
        border: 1px solid rgba(255, 255, 255, 0.055);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.022);
        color: rgba(187, 178, 217, 0.5);
        font: inherit;
        font-size: 0.51rem;
        font-weight: 650;
        cursor: pointer;
        transition: transform 150ms ease, background 150ms ease, color 150ms ease;
    }

    .mobile-folder-shortcut:active {
        transform: scale(0.94);
        background: rgba(144, 116, 232, 0.11);
        color: rgba(224, 216, 249, 0.8);
    }

    /* ── Conversation rows ────────────────────────────────── */
    #chats-list,
    #contacts-list {
        padding: 0 7px;
    }

    #chats-list .chat-item,
    #contacts-list .chat-item {
        isolation: isolate;
        display: flex;
        min-height: 72px;
        align-items: center;
        gap: 12px;
        margin: 0 0 2px;
        padding: 9px 10px;
        overflow: hidden;
        border: 1px solid transparent !important;
        border-radius: 20px !important;
        background: transparent !important;
        box-shadow: none !important;
        -webkit-tap-highlight-color: transparent;
        transition: transform 160ms ease, background 160ms ease, border-color 160ms ease !important;
    }

    #chats-list .chat-item::before,
    #contacts-list .chat-item::before {
        content: "";
        position: absolute;
        z-index: -1;
        inset: 2px;
        border-radius: 18px;
        background: transparent;
        pointer-events: none;
        transition: background 160ms ease;
    }

    #chats-list .chat-item::after,
    #contacts-list .chat-item::after {
        content: "";
        position: absolute;
        right: 11px;
        bottom: 0;
        left: 76px;
        display: block;
        height: 1px;
        background: linear-gradient(90deg, var(--mobile-inbox-line), transparent 88%);
        pointer-events: none;
    }

    #chats-list .chat-item:last-child::after,
    #contacts-list .chat-item:last-child::after {
        display: none;
    }

    #chats-list .chat-item:hover,
    #contacts-list .chat-item:hover {
        transform: none !important;
        background: transparent !important;
    }

    #chats-list .chat-item:active,
    #contacts-list .chat-item:active {
        transform: scale(0.975) !important;
    }

    #chats-list .chat-item:active::before,
    #contacts-list .chat-item:active::before {
        background: rgba(255, 255, 255, 0.05);
    }

    #chats-list .chat-item.unread::before {
        background:
            linear-gradient(105deg, rgba(145, 117, 235, 0.105), rgba(112, 92, 192, 0.025) 65%, transparent);
    }

    #chats-list .chat-item.active,
    #contacts-list .chat-item.active {
        border-color: rgba(158, 135, 244, 0.11) !important;
        background: rgba(136, 108, 224, 0.055) !important;
    }

    #chats-list .chat-item.active::after,
    #contacts-list .chat-item.active::after {
        display: none;
    }

    #chats-list .chat-avatar,
    #contacts-list .chat-avatar,
    #chats-list .channel-avatar {
        position: relative;
        width: 52px;
        height: 52px;
        min-width: 52px;
        overflow: visible;
        border: 1px solid rgba(255, 255, 255, 0.09);
        border-radius: 18px;
        background: linear-gradient(145deg, rgba(139, 115, 230, 0.9), rgba(88, 70, 173, 0.9));
        box-shadow:
            0 8px 19px rgba(2, 4, 12, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.16);
        font-size: 0.92rem;
        font-weight: 760;
        transition: none;
    }

    #chats-list .chat-item.group-chat .chat-avatar {
        background: linear-gradient(145deg, rgba(71, 164, 192, 0.95), rgba(57, 95, 160, 0.95));
    }

    #chats-list .channel-avatar {
        background: linear-gradient(145deg, rgba(237, 165, 69, 0.95), rgba(198, 99, 65, 0.95));
        font-size: 1rem;
    }

    #chats-list .chat-avatar::before,
    #contacts-list .chat-avatar::before {
        border-radius: inherit;
    }

    #chats-list .chat-avatar.online::after,
    #contacts-list .chat-avatar.online::after {
        right: -2px;
        bottom: -2px;
        width: 13px;
        height: 13px;
        border: 2.5px solid rgba(8, 10, 20, 0.95);
        background: #4ed89b;
        box-shadow: 0 0 0 1px rgba(78, 216, 155, 0.18), 0 0 8px rgba(78, 216, 155, 0.48);
    }

    #chats-list .chat-item.unread .chat-avatar {
        border-color: rgba(183, 160, 255, 0.2);
        box-shadow:
            0 9px 23px rgba(68, 47, 154, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.17);
    }

    #chats-list .chat-info,
    #contacts-list .chat-info {
        display: flex;
        min-width: 0;
        flex: 1;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    #chats-list .chat-name,
    #contacts-list .chat-name {
        overflow: hidden;
        margin: 0;
        color: rgba(240, 238, 248, 0.86);
        font-size: 0.82rem;
        font-weight: 650;
        letter-spacing: -0.018em;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #chats-list .chat-item.unread .chat-name {
        color: rgba(253, 252, 255, 0.98);
        font-weight: 760;
    }

    #chats-list .chat-pin-icon {
        margin-right: 4px;
        color: rgba(177, 156, 251, 0.55);
        font-size: 0.48rem;
        opacity: 1;
    }

    #chats-list .chat-preview,
    #contacts-list .chat-preview {
        overflow: hidden;
        max-width: 100%;
        color: rgba(181, 177, 198, 0.43);
        font-size: 0.72rem;
        font-weight: 510;
        line-height: 1.35;
        opacity: 1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #chats-list .chat-item.unread .chat-preview {
        color: rgba(210, 204, 228, 0.66);
    }

    #chats-list .chat-preview .typing-status {
        color: #9dd9c0 !important;
    }

    #chats-list .chat-meta,
    #contacts-list .chat-meta {
        display: flex;
        min-width: 34px;
        align-self: stretch;
        align-items: flex-end;
        justify-content: flex-start;
        flex: 0 0 auto;
        flex-direction: column;
        gap: 7px;
        padding-top: 6px;
    }

    #chats-list .chat-time,
    #contacts-list .chat-time {
        color: rgba(176, 171, 193, 0.38);
        font-size: 0.57rem;
        font-weight: 620;
        line-height: 1;
        opacity: 1;
        white-space: nowrap;
    }

    #chats-list .chat-item.unread .chat-time {
        color: rgba(174, 152, 252, 0.76);
    }

    #chats-list .unread-badge,
    #contacts-list .unread-badge {
        display: grid;
        min-width: 21px;
        height: 21px;
        place-items: center;
        padding: 0 5px;
        border: 1px solid rgba(221, 211, 255, 0.15);
        border-radius: 9px;
        background: linear-gradient(145deg, #9176e7, #7258cf);
        color: #fff;
        box-shadow:
            0 5px 12px rgba(73, 49, 163, 0.23),
            inset 0 1px 0 rgba(255, 255, 255, 0.16);
        font-size: 0.52rem;
        font-weight: 780;
        line-height: 1;
    }

    #chats-list .pinned-divider {
        display: flex;
        min-height: 29px;
        align-items: center;
        padding: 4px 13px 2px;
    }

    #chats-list .pinned-divider span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        color: rgba(177, 170, 201, 0.37);
        font-size: 0.5rem;
        font-weight: 720;
        letter-spacing: 0.055em;
        text-transform: uppercase;
    }

    #chats-list .chat-section {
        margin-top: 8px;
    }

    #chats-list .chat-section-header {
        display: flex;
        min-height: 34px;
        align-items: center;
        gap: 6px;
        padding: 5px 13px;
        color: rgba(181, 174, 204, 0.46);
        font-size: 0.52rem;
        font-weight: 730;
        letter-spacing: 0.065em;
        text-transform: uppercase;
    }

    #chats-list .chat-section-header .btn-icon {
        width: 27px !important;
        height: 27px !important;
        margin-left: auto !important;
        border: 1px solid rgba(255, 255, 255, 0.055) !important;
        background: rgba(255, 255, 255, 0.02) !important;
        color: rgba(198, 188, 224, 0.55) !important;
        box-shadow: none !important;
    }

    /* Empty inbox */
    .mobile-chat-empty {
        display: flex;
        min-height: 250px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        padding: 35px 28px;
        text-align: center;
    }

    .mobile-chat-empty-icon {
        display: grid;
        width: 67px;
        height: 67px;
        place-items: center;
        border: 1px solid rgba(177, 155, 255, 0.13);
        border-radius: 23px;
        background: linear-gradient(145deg, rgba(153, 126, 239, 0.13), rgba(83, 67, 163, 0.035));
        color: rgba(194, 179, 249, 0.65);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
        font-size: 1.15rem;
    }

    .mobile-chat-empty strong {
        margin-top: 15px;
        color: rgba(237, 234, 246, 0.82);
        font-size: 0.84rem;
        font-weight: 740;
    }

    .mobile-chat-empty span {
        max-width: 245px;
        margin-top: 6px;
        color: rgba(177, 172, 195, 0.43);
        font-size: 0.63rem;
        line-height: 1.5;
    }

    .mobile-chat-empty button {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        gap: 7px;
        margin-top: 16px;
        padding: 0 14px;
        border: 1px solid rgba(192, 174, 255, 0.19);
        border-radius: 13px;
        background: linear-gradient(145deg, rgba(145, 116, 232, 0.24), rgba(92, 71, 184, 0.1));
        color: rgba(241, 236, 255, 0.9);
        font: inherit;
        font-size: 0.58rem;
        font-weight: 720;
    }

    /* ── Bottom navigation ────────────────────────────────── */
    .modern-sidebar > .mobile-tabbar {
        position: relative;
        z-index: 30;
        display: flex !important;
        min-height: 64px;
        flex: 0 0 auto;
        align-items: center;
        margin: 5px var(--mobile-inbox-pad) calc(8px + env(safe-area-inset-bottom, 0px));
        padding: 5px;
        overflow: visible;
        border: 1px solid rgba(255, 255, 255, 0.09) !important;
        border-radius: 22px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
            rgba(9, 11, 23, 0.72) !important;
        background-image: none !important;
        box-shadow:
            0 17px 40px rgba(0, 0, 0, 0.35),
            0 5px 18px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.075) !important;
        -webkit-backdrop-filter: blur(34px) saturate(155%) !important;
        backdrop-filter: blur(34px) saturate(155%) !important;
        animation: none;
    }

    .mobile-tabbar::before {
        display: none;
    }

    .mobile-tabbar .mbt-btn {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 52px;
        flex: 1;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        padding: 6px 5px;
        border: 0;
        border-radius: 17px;
        background: transparent;
        color: rgba(187, 182, 203, 0.38);
        font-size: 0.54rem;
        font-weight: 660;
        letter-spacing: 0;
        transition: transform 150ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease;
    }

    .mobile-tabbar .mbt-btn i {
        color: inherit;
        font-size: 1rem;
        filter: none;
        transition: transform 170ms cubic-bezier(0.16, 1, 0.3, 1), color 160ms ease;
    }

    .mobile-tabbar .mbt-btn > span {
        color: inherit;
        font-size: inherit;
        line-height: 1;
    }

    .mobile-tabbar .mbt-btn:active {
        transform: scale(0.94);
    }

    .mobile-tabbar .mbt-btn.mbt-active {
        border: 1px solid rgba(174, 153, 249, 0.13);
        background: linear-gradient(145deg, rgba(147, 119, 234, 0.17), rgba(99, 78, 185, 0.05));
        color: rgba(226, 217, 255, 0.9);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
    }

    .mobile-tabbar .mbt-btn.mbt-active i {
        transform: translateY(-1px) scale(1.04);
        color: #bca9ff;
        filter: none;
    }

    .mobile-tabbar .mbt-btn.mbt-active > span {
        color: rgba(231, 225, 250, 0.83);
    }

    .mobile-tabbar .mbt-av {
        width: 24px;
        height: 24px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
        font-size: 0.52rem;
    }

    .mobile-tabbar .mbt-btn.mbt-active .mbt-av {
        transform: translateY(-1px) scale(1.02);
        box-shadow: 0 0 0 2px rgba(157, 133, 245, 0.2);
    }

    .mobile-tabbar .mbt-unread {
        position: absolute;
        top: 4px;
        left: calc(50% + 6px);
        display: grid;
        min-width: 16px;
        height: 16px;
        place-items: center;
        padding: 0 4px;
        border: 2px solid rgba(11, 13, 25, 0.94);
        border-radius: 999px;
        background: #8b71df;
        color: #fff;
        box-shadow: 0 4px 10px rgba(77, 53, 162, 0.28);
        font-style: normal;
        font-size: 0.42rem;
        font-weight: 800;
        line-height: 1;
    }

    /* ── Light theme ──────────────────────────────────────── */
    [data-theme="light"] .modern-sidebar,
    [data-theme="light"] html:not(.has-open-chat) .modern-sidebar {
        background: linear-gradient(180deg, rgba(248, 247, 252, 0.1), rgba(238, 236, 247, 0.24)) !important;
    }

    [data-theme="light"] .sidebar-brand .sidebar-brand-title,
    [data-theme="light"] #chats-list .chat-name,
    [data-theme="light"] #contacts-list .chat-name {
        color: rgba(37, 32, 51, 0.9);
    }

    [data-theme="light"] .sidebar-brand-summary,
    [data-theme="light"] .mobile-chats-heading-copy > small,
    [data-theme="light"] #chats-list .chat-preview,
    [data-theme="light"] #contacts-list .chat-preview {
        color: rgba(61, 53, 78, 0.48);
    }

    [data-theme="light"] .modern-sidebar .dsearch-pill,
    [data-theme="light"] .sidebar-sys-items .sys-item,
    [data-theme="light"] .modern-sidebar > .mobile-tabbar {
        border-color: rgba(63, 52, 96, 0.1) !important;
        background: rgba(248, 247, 252, 0.72) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 9px 27px rgba(50, 40, 82, 0.09) !important;
    }

    [data-theme="light"] .modern-sidebar .dsearch-field input {
        color: rgba(36, 31, 48, 0.86);
    }

    [data-theme="light"] #chats-list .chat-item::after,
    [data-theme="light"] #contacts-list .chat-item::after {
        background: linear-gradient(90deg, rgba(49, 42, 69, 0.08), transparent 88%);
    }

    [data-theme="light"] #chats-list .chat-item.unread::before {
        background: linear-gradient(105deg, rgba(132, 104, 220, 0.09), rgba(132, 104, 220, 0.015) 70%, transparent);
    }

    [data-theme="light"] #chats-list .chat-item.unread .chat-preview {
        color: rgba(56, 48, 76, 0.62);
    }

    [data-theme="light"] .mobile-tabbar .mbt-btn {
        color: rgba(56, 49, 73, 0.42);
    }

    [data-theme="light"] .mobile-tabbar .mbt-btn.mbt-active {
        border-color: rgba(115, 87, 200, 0.13);
        background: rgba(124, 95, 213, 0.09);
        color: rgba(86, 65, 158, 0.88);
    }
}

@media (max-width: 370px) {
    .modern-sidebar > .sidebar-header {
        min-height: 70px;
    }

    .sidebar-brand-icon {
        width: 38px;
        height: 38px;
        border-radius: 13px;
    }

    .sidebar-brand .sidebar-brand-title {
        font-size: 1.12rem;
    }

    .sidebar-header-actions .sidebar-action-btn {
        width: 37px;
        height: 37px;
        border-radius: 13px;
    }

    .sidebar-sys-items {
        grid-template-columns: 1fr;
    }

    .sidebar-sys-items .sys-item {
        min-height: 54px;
    }

    #chats-list .chat-item,
    #contacts-list .chat-item {
        min-height: 68px;
        gap: 10px;
        padding-right: 8px;
        padding-left: 8px;
    }

    #chats-list .chat-avatar,
    #contacts-list .chat-avatar,
    #chats-list .channel-avatar {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 16px;
    }

    #chats-list .chat-item::after,
    #contacts-list .chat-item::after {
        left: 68px;
    }
}

@media (max-width: 768px) and (max-height: 690px) {
    .modern-sidebar > .sidebar-header {
        min-height: 66px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
    }

    .sidebar-sys-items {
        padding-bottom: 6px;
    }

    .sidebar-sys-items .sys-suggest-banner,
    .sidebar-sys-items .sys-item {
        min-height: 58px;
    }

    .mobile-chats-heading {
        min-height: 32px;
    }

    .modern-sidebar > .mobile-tabbar {
        min-height: 58px;
        margin-bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-tabbar .mbt-btn {
        min-height: 47px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modern-sidebar .chat-item,
    .modern-sidebar .sidebar-action-btn,
    .modern-sidebar .mobile-tabbar,
    .modern-sidebar .mbt-btn {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
