.vk-inbox-nav {
    display: flex;
    align-items: center;
    gap: 7px;
}

.vk-inbox-nav-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.vk-inbox-nav-label svg {
    width: 19px;
    height: 19px;
    color: #2787f5;
}

.vk-inbox-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #2787f5;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    box-shadow: 0 0 13px rgba(39, 135, 245, 0.4);
}

.vk-inbox-badge.hidden {
    display: none;
}

.vk-inbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(10, 12, 24, 0.74);
    backdrop-filter: blur(8px);
}

.vk-inbox-shell {
    width: min(1120px, calc(100vw - 56px));
    height: min(760px, calc(100vh - 56px));
    min-height: 520px;
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 22px;
    background: #202338;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.vk-inbox-left {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(17, 20, 35, 0.38);
}

.vk-inbox-head {
    flex-shrink: 0;
    min-height: 76px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.vk-inbox-title-wrap {
    display: flex;
    align-items: center;
    gap: 11px;
}

.vk-inbox-logo {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(39, 135, 245, 0.12);
    border: 1px solid rgba(39, 135, 245, 0.3);
    color: #2787f5;
}

.vk-inbox-logo svg {
    width: 25px;
    height: 25px;
}

.vk-inbox-title {
    color: #fff;
    font-size: 15px;
    font-weight: 800;
}

.vk-inbox-subtitle {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

.vk-inbox-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #8890a8;
    cursor: pointer;
    font-size: 22px;
}

.vk-inbox-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.vk-inbox-search {
    flex-shrink: 0;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vk-inbox-search input {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    outline: none;
    background: rgba(255, 255, 255, 0.035);
    color: #fff;
    font-size: 12px;
}

.vk-inbox-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.vk-inbox-item {
    padding: 13px 12px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    transition: 0.15s ease;
}

.vk-inbox-item:hover {
    background: rgba(255, 255, 255, 0.035);
}

.vk-inbox-item.active {
    background: rgba(39, 135, 245, 0.1);
    border-color: rgba(39, 135, 245, 0.26);
}

.vk-inbox-avatar {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(39, 135, 245, 0.13);
    color: #2787f5;
}

.vk-inbox-avatar svg {
    width: 24px;
    height: 24px;
}

.vk-inbox-person {
    min-width: 0;
}

.vk-inbox-name {
    overflow: hidden;
    color: #f5f7ff;
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vk-inbox-preview {
    margin-top: 5px;
    overflow: hidden;
    color: #858ca5;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vk-inbox-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.vk-inbox-time {
    color: #656d87;
    font-size: 9px;
}

.vk-inbox-count {
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #2787f5;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
}

.vk-inbox-right {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.vk-inbox-thread-head {
    flex-shrink: 0;
    min-height: 76px;
    padding: 15px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.vk-inbox-thread-name {
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.vk-inbox-profile {
    margin-top: 4px;
    color: #2787f5;
    font-size: 10px;
    text-decoration: none;
}

.vk-inbox-profile:hover {
    text-decoration: underline;
}

.vk-inbox-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
}

.vk-inbox-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #747c96;
    text-align: center;
    font-size: 12px;
}

.vk-inbox-empty svg {
    width: 46px;
    height: 46px;
    color: #2787f5;
    opacity: 0.65;
}

.vk-inbox-message {
    width: fit-content;
    max-width: 72%;
    margin-bottom: 12px;
    padding: 11px 13px;
    border: 1px solid rgba(39, 135, 245, 0.22);
    border-radius: 5px 15px 15px 15px;
    background: rgba(39, 135, 245, 0.08);
    text-align: left;
}

.vk-inbox-message-body {
    color: #f3f5fb;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.vk-inbox-message-time {
    margin-top: 6px;
    color: #69728d;
    font-size: 9px;
}

.vk-inbox-actions {
    flex-shrink: 0;
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(14, 17, 30, 0.26);
}

.vk-inbox-action {
    height: 40px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 11px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
    transition: 0.15s ease;
}

.vk-inbox-action.primary {
    border: 1px solid rgba(39, 135, 245, 0.42);
    background: #2787f5;
    color: #fff;
}

.vk-inbox-action.secondary {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #cdd2e1;
}

.vk-inbox-action:hover {
    transform: translateY(-1px);
}

.vk-link-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 35%, rgba(39, 135, 245, 0.09), transparent 34%),
        rgba(7, 9, 18, 0.82);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
}

.vk-link-dialog {
    width: min(650px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 48px));
    max-height: 720px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(40, 44, 68, 0.98), rgba(31, 35, 55, 0.98));
    box-shadow:
        0 32px 90px rgba(0, 0, 0, 0.56),
        0 0 0 1px rgba(39, 135, 245, 0.04) inset;
}

.vk-link-head {
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.015);
}

.vk-link-head-main {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.vk-link-head-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(39, 135, 245, 0.34);
    border-radius: 13px;
    background: rgba(39, 135, 245, 0.10);
    color: #3d9cff;
    box-shadow: 0 8px 24px rgba(39, 135, 245, 0.08);
}

.vk-link-title {
    color: #fff;
    font-size: 15px;
    font-weight: 850;
    letter-spacing: -0.15px;
}

.vk-link-subtitle {
    margin-top: 4px;
    color: #7f88a3;
    font-size: 10px;
    font-weight: 600;
}

.vk-link-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.04);
    color: #8992aa;
    transition: 0.16s ease;
}

.vk-link-close:hover {
    background: rgba(253, 93, 147, 0.10);
    color: #fd5d93;
    transform: rotate(3deg);
}

.vk-link-search-wrap {
    position: relative;
    margin: 18px 22px 12px;
}

.vk-link-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: #68728d;
    pointer-events: none;
}

.vk-link-search {
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    padding: 0 46px 0 42px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 13px;
    outline: 0;
    background: rgba(12, 15, 28, 0.38);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    transition: 0.18s ease;
}

.vk-link-search::placeholder {
    color: #6d7690;
}

.vk-link-search:focus {
    border-color: rgba(39, 135, 245, 0.62);
    background: rgba(39, 135, 245, 0.055);
    box-shadow:
        0 0 0 3px rgba(39, 135, 245, 0.08),
        0 8px 30px rgba(0, 0, 0, 0.10);
}

.vk-link-list-head {
    padding: 2px 24px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #aeb5ca;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.65px;
}

.vk-link-list-hint {
    color: #606a84;
    font-size: 9px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.vk-link-list {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(39, 135, 245, 0.30) transparent;
}

.vk-link-list::-webkit-scrollbar {
    width: 7px;
}

.vk-link-list::-webkit-scrollbar-track {
    background: transparent;
}

.vk-link-list::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgba(39, 135, 245, 0.24);
}

.vk-link-contact {
    position: relative;
    min-height: 68px;
    padding: 10px 13px;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.018);
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

.vk-link-contact:hover {
    border-color: rgba(39, 135, 245, 0.42);
    background: rgba(39, 135, 245, 0.075);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.vk-link-contact-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(39, 135, 245, 0.28);
    border-radius: 13px;
    background:
        linear-gradient(145deg, rgba(39, 135, 245, 0.18), rgba(39, 135, 245, 0.07));
    color: #58a8ff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.3px;
}

.vk-link-contact-info {
    min-width: 0;
    flex: 1;
}

.vk-link-contact-name {
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vk-link-contact-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #77819a;
    font-size: 9px;
    font-weight: 600;
}

.vk-link-contact-org,
.vk-link-contact-phone {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vk-link-contact-org {
    max-width: 55%;
}

.vk-link-contact-phone {
    color: #55a8ff;
}

.vk-link-contact-org + .vk-link-contact-phone::before {
    content: "•";
    margin-right: 8px;
    color: #4b5570;
}

.vk-link-contact-arrow {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(39, 135, 245, 0.07);
    color: #66708a;
    font-size: 15px;
    opacity: 0;
    transform: translateX(-4px);
    transition: 0.16s ease;
}

.vk-link-contact:hover .vk-link-contact-arrow {
    color: #57aaff;
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 680px) {
    .vk-link-overlay {
        padding: 12px;
    }

    .vk-link-dialog {
        width: 100%;
        height: calc(100vh - 24px);
        max-height: none;
        border-radius: 18px;
    }

    .vk-link-head {
        padding: 18px;
    }

    .vk-link-search-wrap {
        margin: 15px 16px 10px;
    }

    .vk-link-list-head {
        padding-left: 18px;
        padding-right: 18px;
    }

    .vk-link-list-hint {
        display: none;
    }

    .vk-link-list {
        padding-left: 10px;
        padding-right: 10px;
    }

    .vk-link-contact {
        min-height: 64px;
    }
}

.vk-inbox-message-files {
    margin-top: 9px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vk-inbox-message-image {
    display: block;
    max-width: 280px;
    max-height: 240px;
    border-radius: 10px;
    object-fit: cover;
}

.vk-inbox-message-file {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid rgba(39, 135, 245, 0.24);
    border-radius: 9px;
    background: rgba(39, 135, 245, 0.08);
    color: #8fc4ff;
    font-size: 10px;
    text-decoration: none;
    word-break: break-all;
}

.vk-inbox-message-file:hover {
    background: rgba(39, 135, 245, 0.14);
}

.vk-inbox-toast {
    position: fixed;
    z-index: 10200;
    right: 28px;
    bottom: 28px;
    max-width: 360px;
    padding: 12px 16px;
    border: 1px solid rgba(39, 135, 245, 0.3);
    border-radius: 12px;
    background: #25293e;
    color: #e9edf8;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
    font-size: 11px;
}

@media (max-width: 900px) {
    .vk-inbox-shell {
        grid-template-columns: 290px minmax(0, 1fr);
    }
}


/* VK Inbox photo grid */
.vk-inbox-photo-grid {
    width: min(300px, 100%);
    display: grid;
    gap: 4px;
    overflow: hidden;
    border-radius: 9px;
}

.vk-inbox-photo-grid.photos-1 { grid-template-columns: 1fr; }
.vk-inbox-photo-grid.photos-2,
.vk-inbox-photo-grid.photos-3,
.vk-inbox-photo-grid.photos-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.vk-inbox-photo-grid.photos-1 .vk-inbox-photo-cell { aspect-ratio: 4 / 3; }
.vk-inbox-photo-grid.photos-2 .vk-inbox-photo-cell,
.vk-inbox-photo-grid.photos-4 .vk-inbox-photo-cell { aspect-ratio: 1 / 1; }
.vk-inbox-photo-grid.photos-3 .vk-inbox-photo-cell { aspect-ratio: 1 / 1; }
.vk-inbox-photo-grid.photos-3 .vk-inbox-photo-cell:first-child {
    grid-row: span 2;
    aspect-ratio: auto;
}

.vk-inbox-photo-cell {
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.vk-inbox-photo-cell img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.vk-inbox-photo-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    pointer-events: none;
}

/* Two-way chat before contact linking */
.vk-inbox-actions {
    flex-direction: column;
    align-items: stretch;
}

.vk-inbox-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.vk-inbox-message.outgoing {
    margin-left: auto;
    border-color: rgba(225, 78, 202, 0.38);
    border-radius: 15px 5px 15px 15px;
    background: rgba(225, 78, 202, 0.08);
    text-align: right;
    box-shadow: 0 0 16px rgba(225, 78, 202, 0.08);
}

.vk-inbox-message-author {
    margin-bottom: 5px;
    color: #e14eca;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.vk-inbox-selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vk-inbox-selected-files.hidden {
    display: none;
}

.vk-inbox-file-chip {
    max-width: 220px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px 6px 10px;
    border: 1px solid rgba(39, 135, 245, 0.24);
    border-radius: 9px;
    background: rgba(39, 135, 245, 0.08);
    color: #b8d8ff;
    font-size: 9px;
}

.vk-inbox-file-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vk-inbox-file-chip button {
    border: 0;
    background: transparent;
    color: #ff6b9b;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.vk-inbox-composer {
    min-height: 48px;
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
    background: rgba(9, 12, 23, 0.42);
}

.vk-inbox-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 30px;
    max-height: 100px;
    padding: 6px 4px;
    border: 0;
    outline: 0;
    resize: vertical;
    background: transparent;
    color: #eef2ff;
    font: inherit;
    font-size: 11px;
    line-height: 1.45;
}

.vk-inbox-composer textarea::placeholder {
    color: #69728d;
}

.vk-inbox-attach,
.vk-inbox-send {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
}

.vk-inbox-attach {
    color: #8fc4ff;
    background: rgba(39, 135, 245, 0.08);
    border: 1px solid rgba(39, 135, 245, 0.22);
}

.vk-inbox-attach:hover {
    background: rgba(39, 135, 245, 0.15);
}

.vk-inbox-send {
    border: 1px solid rgba(0, 242, 195, 0.28);
    background: rgba(0, 242, 195, 0.10);
    color: #00f2c3;
    font-size: 18px;
    transition: 0.15s ease;
}

.vk-inbox-send:hover:not(:disabled) {
    transform: translateX(2px);
    background: rgba(0, 242, 195, 0.16);
}

.vk-inbox-send:disabled {
    cursor: default;
    opacity: 0.75;
}

.vk-inbox-send-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(0, 242, 195, 0.20);
    border-top-color: #00f2c3;
    border-radius: 50%;
    animation: vk-inbox-send-spin 0.75s linear infinite;
}

@keyframes vk-inbox-send-spin {
    to { transform: rotate(360deg); }
}


/* Метка канала в общем списке «ВК + MAX» */
.vk-inbox-chan {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.4px;
    vertical-align: middle;
}

.vk-inbox-chan-vk {
    color: #2787f5;
    background: rgba(39, 135, 245, 0.14);
}

.vk-inbox-chan-max {
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.16);
}
