html, body {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: auto;
	min-height: 100%;
	overflow: hidden;
	background: #525455;
	font-size: 12px;
}

body {
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
}

.clear {
	display: block;
	margin: 0;
	padding: 0;
	clear: both;
	float: none;
}

.pull-left {
	float: left;
}

.pull-right {
	float: right;
}

.p-global-wrapper {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
}

.p-global-wrapper .p-global-wrapper__inner {
	position: relative;
	min-height: 100%;
	min-width: 1000px;
	overflow: hidden;
}

body.login .p-global-wrapper .p-global-wrapper__inner {
	min-height: 480px;
	height: 100%;
}

.p-content-wrapper {
	width: 960px;
	min-height: 500px;
	margin: 0 auto 76px;
}

.p-content-wrapper.full-height {
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 76px;
	min-height: 300px;
	margin: 0;
	margin-left: -480px;
}

/* Главная колонка и оба сайдбара
   ========================================================================== */

.p-sidebar {
	min-height: 2px;
	float: left;
}

.p-sidebar.left {
	width: 220px;
	margin-left: 10px;
	position: relative;
	z-index: 10;
}

.p-sidebar.right {
	width: 160px;
	margin-left: 20px;
}

.p-sidebar.left .sidebar-left-inner {
	position: fixed;
	width: 220px;
}

.p-sidebar .full-height {
	position: absolute;
	top: 95px;
	bottom: 96px;
}

.p-sidebar.left .full-height {
	position: static;
}
.p-sidebar .full-height .full-height-fixed.sticky {
	position: fixed;
	top: 20px;
	height: auto;
	width: auto;
	bottom: 20px;
    padding-left: 15px;
}

.p-sidebar .full-height .full-height-fixed.partially-hidden {
	overflow: hidden;
	margin-left: -1px;
	margin-top: -1px;
	padding-left: 1px;
	padding-top: 1px;
}


.p-sidebar .full-height .full-height-fixed.partially-hidden .b-user-list-controls {
	padding-top: 2px;
}

.p-sidebar .full-height .full-height-inner {
	position: absolute;
	top: 0;
	bottom: 0;
}

.p-sidebar.left .full-height  { width: 1px; }
.p-sidebar.right .full-height { width: 160px; }
.p-sidebar.left .full-height .full-height-inner {
	position: static;
	width: 220px;
	height: auto;
}
.p-sidebar.right .full-height .full-height-inner { width: 160px; }

.p-sidebar .scrollable-area {
	width:  100%;
	height: 100%;
	overflow: hidden;
}

.p-sidebar .scrollable-area .content {
	position: relative;
	overflow: hidden;
}

.p-sidebar .scrollbar {
	position: absolute;
	bottom: 0;
	right: -10px;
	width:  6px;
	height: 100%;
	background: #4a4a4a;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	-ms-border-radius: 2px;
	-o-border-radius: 2px;
	border-radius: 2px;
}

.p-sidebar .scrollbar .body {
	position: absolute;
	top: 0;
	left: 0;
	width:  100%;
	height: 100px;
	background: #2a2a2a;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	-ms-border-radius: 2px;
	-o-border-radius: 2px;
	border-radius: 2px;
	cursor: pointer;
	-webkit-transition: background 100ms linear, width 100ms linear, left 100ms linear;
	-moz-transition: background 100ms linear, width 100ms linear, left 100ms linear;
	-ms-transition: background 100ms linear, width 100ms linear, left 100ms linear;
	-o-transition: background 100ms linear, width 100ms linear, left 100ms linear;
	transition: background 100ms linear, width 100ms linear, left 100ms linear;
}

.p-sidebar .scrollbar .body:hover,
.p-sidebar .scrollbar .body.active {
	left: -3px;
	width:  12px;
	background: #63b1ca;
}

.p-main-column {
	width: 520px;
	min-height: 2px;
	margin-left: 20px;
	float: left;
}

.p-main-column.tree {
	margin-left: 10px;
	padding-left: 9px;
	border-left: 1px solid #3d3d3d;
}

.p-main-column .full-height {
	position: absolute;
	top: 95px;
	bottom: 96px;
	width: 520px;
}

/* Стилизованный контент.
   ========================================================================== */

.p-styled-content {
	word-break: break-word;
}

.p-styled-content p {
	margin: 10px 0;
}

.p-styled-content p:first-child {
	margin-top: 0;
}

.p-styled-content p:last-child {
	margin-bottom: 0;
}


.b-dialog-header {
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.b-dialog-header .back-link {
    display: inline-flex;
    align-items: center;
    color: #666;
    text-decoration: none;
    margin-bottom: 10px;
    font-size: 13px;
    background-color: #fff;
    padding: 4px 10px 3px 6px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.b-dialog-header .back-link:hover {
    color: #333;
}

.b-dialog-header .partner-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.b-dialog-header .partner-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.b-dialog-header .partner-name {
    font-size: 16px;
    font-weight: bold;
}

.b-messages-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
}

.b-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
}

.b-message-form {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.b-message-form .message-input textarea {
    width: 95%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

.b-message-form .message-input textarea:focus {
    outline: none;
    border-color: #007bff;
}

.b-message-form .message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.b-message-form .upload-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #666;
    font-size: 13px;
}

.b-message-form .send-message-btn {
    min-width: 120px;
}

/* Стили сообщений */
.message-item {
    display: flex;
    margin-bottom: 15px;
}

.message-item.mine {
    justify-content: flex-end;
}

.message-item .message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 12px;
    background: #e9ecef;
}

.message-item.mine .message-content {
    background: #007bff;
    color: #fff;
}

.message-item .message-author {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.message-item.mine .message-author {
    color: rgba(255,255,255,0.8);
}

.message-item .message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-item .message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

.message-item.mine .message-time {
    color: rgba(255,255,255,0.7);
}

.message-item .read-status {
    margin-left: 5px;
}

.message-item .read-status.read {
    color: #4caf50;
}

/* Файлы */
.message-files {
    margin-top: 8px;
}

.message-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    margin-right: 5px;
    margin-top: 3px;
}

.no-messages {
    text-align: center;
    color: #999;
    padding: 30px;
}

/* Индикатор загрузки */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading-indicator .icon.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Список диалогов */
.b-dialogs-list-container {
    margin-top: 20px;
}

.b-dialogs-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.b-dialogs-list .dialog-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.b-dialogs-list .dialog-item:hover {
    background: #f5f5f5;
}

.b-dialogs-list .dialog-item.active {
    background: #e3f2fd;
}

.b-dialogs-list .dialog-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.b-dialogs-list .dialog-info {
    flex: 1;
    min-width: 0;
}

.b-dialogs-list .dialog-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.b-dialogs-list .dialog-name {
    font-weight: bold;
    color: #333;
}

.b-dialogs-list .dialog-time {
    font-size: 12px;
    color: #999;
}

.b-dialogs-list .dialog-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.b-dialogs-list .last-message {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.b-dialogs-list .unread-badge {
    background: #007bff;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.b-maincolumn-nodata {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

.b-dialogs-list .dialog-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
    background-color: #c5c5c5;
    border-radius: 8px;
}

.b-dialogs-list li{ list-style:none; }



.ico { width: 16px; height: 16px; vertical-align: middle; }

.b-attach-preview { margin-top: 8px; display:none; gap:6px; flex-wrap: wrap; }
.attach-chip { display:inline-flex; align-items:center; gap:8px; background:#f1f1f1; padding:6px 10px; border-radius:999px; font-size:12px; }
.attach-remove { border:0; background:transparent; cursor:pointer; font-size:16px; line-height:1; }

.media { margin-top: 8px; }
.media img { max-width: 260px; border-radius: 8px; display:block; }
.media video { max-width: 320px; width: 100%; border-radius: 8px; display:block; }
.media audio { width: 100%; }
.media-caption { font-size: 12px; opacity: .8; margin-top: 4px; }


.message-files { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px; }

.media { width: 100%; }
.message-item .message-content .media { max-width: 420px; }

.media-image a { display: block; }
.media-image img {
    display: block;
    max-width: 200px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
}

.media-video video {
    display: block;
    width: 100%;
    max-width: 420px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #000;
}

.media-audio audio {
    width: 100%;
    max-width: 420px;
}

.media-caption {
    font-size: 12px;
    opacity: .8;
    margin-top: 4px;
    word-break: break-word;
}

.message-item.mine .media-caption { opacity: .85; }

.dialog-media-popup {
    position: relative;
    margin-top: 10px;
}

.dialog-media-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    min-width: 150px;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #d6e4e9;
    border-radius: 10px;
    background: #fff;
    color: #247991;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.dialog-media-toggle span {
    margin-left: 10px;
    color: #8a9aa3;
}

.dialog-media-panel {
    position: absolute;
    top: 38px;
    left: 0;
    z-index: 30;
    width: 360px;
    padding: 12px;
    background: #fff;
    border: 1px solid #dce7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,.16);
}

.dialog-media-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.dialog-media-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.dialog-media-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #e2e7ea;
    border-radius: 6px;
    background: #f9fbfc;
    color: #5b6b74;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.dialog-media-group em {
    font-style: normal;
    color: #8a9aa3;
}

.dialog-media-group.active {
    background: #eef8fb;
    border-color: #9fcbd8;
    color: #247991;
}

.dialog-media-items {
    display: none;
    flex-direction: column;
    gap: 5px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.dialog-media-items.active {
    display: flex;
}

.dialog-media-item {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
    color: #247991;
    text-decoration: none;
    font-size: 12px;
}

.dialog-media-item:hover {
    text-decoration: underline;
}

.dialog-media-item-icon {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9fcbd8;
}

.dialog-media-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dialog-media-empty {
    color: #a0a0a0;
    font-size: 12px;
}


/* ===== Chat window (LK style) ===== */

.p-main-column .chat-window{
    background: transparent;
}

.chat-window .b-dialog-header{
    padding: 0 0 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.chat-window .b-dialog-header .back-link{
    display: inline-flex;
    align-items: center;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    background-color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    margin-bottom: 14px;
}

.chat-window .b-dialog-header .back-link:hover{
    color: #333;
    border-color: #d0d0d0;
}

.chat-window .b-dialog-header .partner-info{
    display:flex;
    align-items:center;
    gap:12px;
    background-color:#fff;
    padding:10px 12px;
    border-radius:10px;
}

.chat-window .b-dialog-header .partner-avatar img{
    width:48px;
    height:48px;
    border-radius:50%;
    object-fit:cover;
}

.chat-window .b-dialog-header .partner-name{
    font-size:16px;
    font-weight:bold;
    color:#333;
}

.chat-window .b-dialog-header .partner-meta{
    row-gap:3px;
    display:flex;
    flex-direction:column;
    min-width:0;
}

.chat-window .b-dialog-header .partner-status{
    display:flex;
    align-items:center;
    gap:6px;
    font-size:12px;
    color:#777;
}

.chat-window .b-dialog-header .partner-status span{
    width:8px;
    height:8px;
    border-radius:50%;
    background:#b8c0c5;
}

.chat-window .b-dialog-header .partner-status.online span{
    background:#39a96b;
}

.chat-window .b-dialog-header .partner-last-seen{
    font-size:12px;
    color:#8a8a8a;
}

/* wrapper height to fit your layout */
.chat-window .b-messages-wrapper{
    display:flex;
    flex-direction:column;
    height: calc(100vh - 250px);
    min-height: 380px;
}

/* list */
.chat-window .b-messages-list{
    flex:1;
    overflow-y:auto;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e6e6e6;
    margin-bottom: 15px;
}

/* compose */
.chat-window .b-message-form{
    background:#fff;
    padding: 12px 12px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.chat-window .b-message-form .message-input textarea{
    width: 100%;
    min-height: 70px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.chat-window .b-message-form .message-input textarea:focus{
    outline: none;
    border-color: #63b1ca; /* ваш акцент */
}

.chat-window .b-message-form .message-actions{
    display:flex;
    justify-content: space-between;
    align-items:center;
    margin-top: 10px;
    gap: 10px;
}

.chat-window .b-message-form .send-message-btn{
    min-width: 140px;
}

.chat-window .b-message-form .upload-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:9px;
    min-height:32px;
    padding:0 18px;
    border:1px solid #9fcbd8;
    border-radius:6px;
    background:#f4fbfd;
    color:#247991;
    cursor:pointer;
    font-size:13px;
    font-weight:600;
    line-height:1;
    box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
    transition:background .15s ease, border-color .15s ease, color .15s ease;
}

.chat-window .b-message-form .upload-button:hover{
    background:#e8f6fa;
    border-color:#63b1ca;
    color:#1f6f86;
}

.chat-window .b-message-form .upload-button:active{
    background:#dff1f6;
}

.chat-window .b-message-form .upload-button .upload-icon,
.chat-window .b-message-form .upload-button svg{
    display:block;
    width:21px;
    height:21px;
}

.b-announcement-block,
.b-announcement-block .block-header,
.b-announcement-block .content,
.b-announcement-block .description,
.b-announcement-block p{
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing:0;
}

.b-announcement-block .content,
.b-announcement-block .description,
.b-announcement-block p{
    font-size:15px;
    line-height:1.55;
}

/* messages */
.chat-window .message-item{
    display:flex;
    margin-bottom: 12px;
}

.chat-window .message-item.mine{
    justify-content:flex-end;
}

.chat-window .message-item .message-content{
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e9ecef;
    border: 1px solid rgba(0,0,0,0.06);
    box-sizing: border-box;
}

.chat-window .message-item.mine .message-content{
    background: #63b1ca;      /* под ваш hover-скроллбар */
    color:#fff;
    border-color: rgba(0,0,0,0.08);
}

.chat-window .message-item .message-text{
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-window .message-item .message-time{
    font-size: 11px;
    color: #888;
    margin-top: 6px;
    text-align:right;
}

.chat-window .message-item.mine .message-time{
    color: rgba(255,255,255,0.8);
}

.chat-window .read-status{
    display:inline-flex;
    align-items:center;
    gap:0;
    margin-left:6px;
    color:rgba(255,255,255,.72);
    vertical-align:middle;
}

.chat-window .read-status.read{
    color:#c9f6d4;
}

.chat-window .read-status svg{
    display:block;
    width:14px;
    height:14px;
}

.chat-window .read-status svg + svg{
    margin-left:-5px;
}

/* empty */
.chat-window .no-messages{
    text-align:center;
    color:#999;
    padding: 30px 10px;
}

.b-attach-preview {
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.attach-chip {
    display: flex;
    align-items: center;
    background: #f2f4f7;
    border-radius: 20px;
    padding: 6px 10px;
    font-size: 13px;
}

.attach-name {
    margin-right: 4px;
}

.attach-size {
    color: #888;
    margin-right: 8px;
}

.attach-remove {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

/* КОСТЫЛЬ, ПОПРАВИТЬ */
li.item:has(a[href="/cabinet/index.php/?ID=#IBLOCK_ID#"]) {
    display: none;
}