@charset "UTF-8";
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
}

.chat-container {
    display: flex;
    height: calc(100vh - 100px);
    overflow: hidden;
    min-width: 0; /* 🧠 Додаємо */
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* === Ліва панель (чати) === */
.contacts {
    border-right: 1px solid #ddd;
    background-color: #fafafa;
}
.chat-search, .chat-list  {
    width: 300px;
    min-width: 300px; /* ✅ Забороняє зменшувати */
    max-width: 300px; /* (опційно) — фіксує розмір */
    padding: 0px 10px;
    box-shadow: 0 4px 18px rgb(12 84 160 / 22%);
}
.chat-search {
    box-shadow: 0px 5px 1px 0px #fff;
    z-index: 10;
    position: relative;
}
.typeahead.chat-list {
    max-height: 400px;
}
#chat-list {
    width: 300px;
    min-width: 300px; /* ✅ Забороняє зменшувати */
    max-width: 300px; /* (опційно) — фіксує розмір */
    flex-shrink: 0;   /* ✅ Забороняє стискатись */
    overflow-y: auto;
    height: calc(100% - 116px);
    background-color: #fff;
    padding: 10px;
}

.contact, .contact-suggest {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.contact:hover, .contact-suggest:hover,
.contact.active, .contact-suggest.active {
    background-color: #f0f0f0;
}

.avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    margin-right: 10px;
    flex-shrink: 0;
}

.avatar-main {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-last, .user_activity {
    position: absolute;
    bottom: -4px;
    right: -10px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 1;
    background-size: cover;
    background-position: center;
    object-fit: cover;
}
.user_activity.status-green,
.user_activity.status-orange {
    right: -4px;
}
.user_activity {
    width: 14px;
    height: 14px;
}
.status-green {
    background-color: #4caf50;
}

.status-orange {
    background-color: #ff9800;
}
.contact-body {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.name-line strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: font-weight 0.2s, color 0.2s;
}

.chat-time {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
}

.badge-unread {
    background-color: #dc3545;
    color: #fff;
    border-radius: 999px;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    padding: 0 6px;
    font-size: 12px;
    text-align: center;
    display: inline-block;
}

/* === Жирність імен === */
.chat-name-weight-600 {
    font-weight: 700;
    color: #000;
}
.chat-name-weight-400 {
    font-weight: 500;
    color: #333;
}
.chat-name-weight-200 {
    font-weight: 300;
    color: #666;
}

/* === Права частина — чат === */
.chat-box {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    position: relative;
}
.mini-chat .messages {
    flex-grow: 1;
    padding: 8px;
    overflow-y: auto;
    background: #f9f9f9;
    max-height: 300px;
    min-height: 300px;
}
.messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fdfdfd;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* 🧠 Обов’язково */
    word-break: break-word;
    overflow-wrap: anywhere;
}
.chat-header {
    padding: 0px 20px;
}

/* === Група повідомлень === */
.message-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    max-width: 100%;
}

.message-group.sent {
    flex-direction: row-reverse;
    /*text-align: right;*/
}
.message-group.sent .message-meta {
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.message-group.sent .message-name {
    margin-left: 6px;
}
.message-group.sent .message-time {
    margin-right: 6px;
}
.mini-chat-messages .author-icon-wrap {
    width: 24px;
    margin: 0 5px;
    flex-shrink: 0;
}
.mini-chat-messages .author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}
.author-icon-wrap {
    width: 36px;
    margin: 0 10px;
    flex-shrink: 0;
}

.author-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}
.seen-user {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}
.seen-user img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}
.message-body {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 4px;
    color: #777;
}

.message-name {
    font-weight: bold;
    color: #555;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}

/* === Бульбашки === */
.message-bubbles {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-start;
}

.message-group.sent .message-bubbles {
    align-items: flex-end;
}
.bubble-row.deleted .bubble {
    /*background:transparent!important;*/
    background: #f7f6f6 !important;
    font-style: italic;
    color: #ababab;
}
.bubble-row.deleted .seen-check, .bubble-row.deleted .bubble-actions, .bubble-row.deleted .reaction-btn {
    visibility: hidden !important;
}
.bubble {
    background-color: #f1f1f1;
    padding: 8px 12px;
    border-radius: 16px;
    max-width: 100%;
    /*display: inline-flex;*/
    align-items: center;
    transition: padding 0.25s ease, margin 0.25s ease, line-height 0.25s ease, min-height 0.25s ease;
    min-height: 30px;
}
.bubble .message-data {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-line;
}
.message-edited-time {
    color: #888;
    font-size: 8px;
}
.message-group.sent .message-edited-time {
    text-align: right;
}
.message-group.sent .bubble {
    background-color: #ccf7ff;
    border-bottom-right-radius: 0;
}
.message-group.received {
    flex-direction: row;
    text-align: left;
}

.message-group.received .bubble {
    border-bottom-left-radius: 0;
}

/* === Реакції === */
.message-reactions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    /*margin-top: 6px;*/
}
.message-reaction-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-block;
    margin-top: -4px;
}
/*.message-group.received .message-reaction-wrapper {*/
/*    margin-right: 4px;*/
/*}*/
/*.message-group.received .message-reaction-wrapper:last-of-type {*/
/*    margin-right: 0;*/
/*}*/
/*.message-group.sent .message-reaction-wrapper {*/
/*    margin-left: 4px;*/
/*}*/
/*.message-group.sent .message-reaction-wrapper:first-of-type {*/
/*    margin-left: 0;*/
/*}*/

.message-group.sent .message-reactions {
    justify-content: flex-end;
}

.message-group.received .message-reactions {
    justify-content: flex-start;
}

.message-reaction {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #fff;
    background-size: cover;
    background-position: center;
    position: relative;
}

.message-reaction:hover::after {
    content: attr(data-user);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 2px 5px;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 999;
}

/* === Підсвітка непрочитаного === */
.bubble.unread-highlight {
    animation: blink-unread 1s ease-in-out 2;
}

@keyframes blink-unread {
    0%   { background-color: #fff9c4; }
    50%  { background-color: #fff176; }
    100% { background-color: #fff9c4; }
}

/* === Поле вводу === */
.message-input-container {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 16px;
    color: #333;
    margin: 1rem;
    border-radius: 20px;
    width: 90%;
    /*padding: 10px;*/
    /*border-top: 1px solid #ddd;*/
    /*background-color: white;*/
}

/*.message-input-container input {*/
/*    width: 100%;*/
/*    padding: 10px;*/
/*    border-radius: 20px;*/
/*    background-color: #f1f1f1;*/
/*    border: 1px solid #ccc;*/
/*    font-family: inherit;*/
/*    font-size: 16px;*/
/*    color: #333;*/
/*}*/
.message-input-container textarea:focus {
    outline: none;
}

.message-input-container textarea {
    width: 100%;
    border-radius: 20px;
    resize: none;
    overflow-y: auto;
    padding: 10px 50px 10px 32px; /* ⬅️ Збільшено top/bottom padding */
    line-height: 1.4; /* ⬅️ Додано для кращого міжрядкового інтервалу */
    box-sizing: border-box;
    scrollbar-gutter: stable both-edges;
    background: transparent;
    border: none !important;
    font-size: 14px;
    /*border-right: none !important;*/
    /*border-bottom: none !important;*/
}

/* === Анімація оновлення чату === */
.contact.flash {
    background-color: #d1ecf1 !important;
    transition: background-color 1s ease;
}

/* === Контекстне меню === */
.context-menu {
    position: absolute;
    display: none;
    z-index: 999;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border-radius: 4px;
    min-width: 150px;
}

.context-menu .item {
    padding: 10px 15px;
    cursor: pointer;
}

.context-menu .item:hover {
    background-color: #f8f9fa;
}

/* === Стилі скролбарів === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

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

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

/* === Pending повідомлення === */
.bubble.pending {
    position: relative;
    opacity: 0.6;
}

.bubble.pending::after {
    content: '⏳';
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 12px;
    color: #666;
    animation: fadePulse 1.5s infinite;
}

@keyframes fadePulse {
    0%   { opacity: 0.2; }
    50%  { opacity: 1; }
    100% { opacity: 0.2; }
}
.message-loader {
    text-align: center;
    color: #888;
    padding: 10px 0;
    font-size: 13px;
}
.contact-body small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: #555;
}
.mini-chat .char-limit-info {
    padding: 4px 1rem;
    margin-bottom: 0;
}
.char-limit-info {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    text-align: right;
    min-height: 1em;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.char-limit-info.hidden {
    opacity: 0;
}
.bubble-row {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    gap: 4px;
}
.message-group .bubble-row {
    margin-left: -16px;
}

.message-group.sent .bubble-row {
    flex-direction: row-reverse;
    margin-right: -16px;
}

.seen-check {
    font-size: 14px;
    color: gray;
}

.seen-check::before {
    content: '✔';
}

.seen-check.seen {
    color: #2196f3;
}
.chat-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(1px);
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto; /* блокує кліки */
    z-index: 999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.chat-loader.hidden {
    opacity: 0;
    display: none;
}

.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.emoji-input-wrap {
    position: relative;
    /*padding: 8px;*/
    /*border-top: 1px solid #ddd;*/
    /*background: #fff;*/
}

.textarea-container {
    position: relative;
    display: flex;
    align-items: center;
}

/*.textarea-container textarea {*/
/*    width: 100%;*/
/*    min-height: 40px;*/
/*    font-size: 14px;*/
/*    border-radius: 6px;*/
/*    border: 1px solid #ccc;*/
/*    resize: none;*/
/*}*/

.emoji-btn, .attach-btn, .send-btn, .attach-order-btn {
    position: absolute;
    /*left: 8px;*/
    bottom: 10px;
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /*position: absolute;*/
    /*left: 8px;*/
    /*top: 50%;*/
    /*transform: translateY(-50%);*/
    background: none;
    outline: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    /*display: flex;*/
    /*align-items: center;*/
    /*justify-content: center;*/
}
.mini-chat .message-input-container {
    width: 80%;
}
.mini-chat .send-btn {
    right: calc(100% - 80% - 2rem - 36px);
}
.send-btn {
    background: #4489ff;
    padding: .5rem;
    border-radius: 50%;
    bottom: calc(1rem + 4px);
    right: calc(100% - 90% - 2rem - 36px);
    width: 36px;
    height: 36px;
}
.emoji-btn {
    left: 10px;
}
.attach-btn {
    right: 10px;
}
.emoji-btn:focus, .attach-btn:focus, .send-btn:focus, .remove-attach:focus {
    outline: none;
}
.attach-input {
    display: none;
}
.emoji-popup {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    position: absolute;
    bottom: 40px; /* або як зручно */
    left: 8px;
    z-index: 999;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    max-height: calc(3 * 24px + 2 * 6px + 16px);
    overflow-y: auto;
    width: 100%; /* або фіксована ширина, якщо потрібно */
    max-width: 300px; /* опціонально */
}

.emoji-popup img {
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.emoji-popup.hidden, #quick-emoji-popup.hidden, .attachment-preview.hidden, .send-btn.hidden, .attach-btn.hidden, .order-preview.hidden {
    display: none !important;
}

.emoji-popup img {
    width: 24px;
    height: 24px;
    cursor: pointer;
}


.reaction-btn {
    margin-left: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    outline: none;
    border: none;
    background: transparent;
    padding: 0px;
    position: relative;
}
.reaction-btn:active, .reaction-btn:focus {
    outline: none;
}
.reaction-btn:hover {
    opacity: 1;
}
#quick-emoji-popup {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    z-index: 999;
    max-width: 300px;
    overflow-x: auto;
    white-space: nowrap;
}
.reaction-emoji {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}
.reaction-avatar {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}
.quick-emoji-list img {
    width: 24px;
    height: 24px;
    margin: 2px;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.quick-emoji-list img:hover {
    transform: scale(1.2);
}
.seen-user-tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 10;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    white-space: nowrap;
}
.bubble-row {
    position: relative;
    display: flex;
    align-items: center;
}

/*.bubble-actions {*/
/*    visibility: hidden;*/
/*    margin-right: 8px;*/
/*}*/

/*.bubble-menu-btn {*/
/*    background: none;*/
/*    border: none;*/
/*    font-size: 20px;*/
/*    cursor: pointer;*/
/*    color: #666;*/
/*    padding: 0;*/
/*}*/

.bubble-row:hover .bubble-actions {
    visibility: visible;
}

.bubble-actions {
    visibility: hidden;
    /*margin-right: 6px;*/
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 100%;
}

.bubble-menu-btn {
    background: none;
    border: none;
    /*font-size: 18px;*/
    cursor: pointer;
    color: #888;
    padding: 0;
    line-height: 1;
    outline: none;
}
.bubble-menu-btn:focus, .scroll-to-msg-btn:focus, .filter-btn:focus {
    outline: none;
}
.filter-btn .img-wrap {
    /*border-radius: 50%;*/
    /*border: 1px solid #45454c;*/
    padding: .3rem;
    height: 34px;
    width: 34px;
    margin: auto;
    filter:grayscale(1)
}
.filter-btn .img-wrap img {
    height: 24px;
    width: 24px;
}
.filter-btn small {
    margin-top: .2rem;
}
.filter-btn {
    padding: .5rem !important;
    border-radius: 5px;
    text-align: center;
    width: 62px;
    color: #666666;
}
.filter-btn.active {
    background: #cadffe;
    /*color: #fff;*/
}
.scroll-to-msg-btn, .filter-btn {
    background: none;
    border: none;
    /*font-size: 18px;*/
    cursor: pointer;
    padding: 0;
    line-height: 1;
    outline: none;
}
.bubble.highlighted {
    box-shadow: 0 0 0 2px #4caf50;
    border-radius: 12px;
    animation: flash-border 1s ease-in-out;
}

@keyframes flash-border {
    0% { box-shadow: 0 0 0 2px #4caf50; }
    100% { box-shadow: 0 0 0 0 transparent; }
}


.bubble-menu {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    z-index: 100020;
    min-width: 160px;
    padding: 6px 0;
    font-size: 14px;
    animation: fadeIn 0.2s ease;
}

.bubble-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bubble-menu li {
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.bubble-menu li:hover {
    background: #f0f0f0;
}

.bubble-menu.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.message-reply {
    background: #fff;
    padding: .4rem;
    /*border-radius: 5px;*/
    border-left: 3px solid #2196f3 !important;
    box-shadow: rgba(0, 0, 0, 0.12) 0px 0px 2px 0px, rgba(0, 0, 0, 0.14) 0px 1px 2px 0px;
    border-top-right-radius: 5px;
    border-top-left-radius: 0px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
    /*background-color: rgb(248, 248, 248);*/
    margin-bottom: .5rem;
}
.received .message-reply {
    /*border: 1px solid #cecece;*/
}
.sent .message-reply {
    /*border: 1px solid #45afba;*/
}
.reply-meta {
    color: #888;
    font-size: 8px;
    margin-top: .3rem;
}
.reply-preview {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
/*.message-input-container {*/
/*    border-top: 1px solid #ccc;*/
/*    padding: 10px;*/
/*    background: #fff;*/
/*}*/
.emoji-input-wrap {
    position: relative;
}
.textarea-container {
    position: relative;
    display: flex;
    flex-direction: column;
}
.reply-preview-block {
    width: calc(100% - 2rem);
    padding: 6px 10px;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
    display: none;
    flex-shrink: 0;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
    word-break: break-word;
    margin: 1rem;
    background: #fff;
    /* border-radius: 5px; */
    border-left: 3px solid #2196f3 !important;
    box-shadow: rgba(0, 0, 0, 0.12) 0px 0px 2px 0px, rgba(0, 0, 0, 0.14) 0px 1px 2px 0px;
    border-top-right-radius: 5px;
    border-top-left-radius: 0px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
}
.reply-preview-block.visible {
    display: flex;
}
.reply-content {
    display: flex;
    flex-direction: row;
    flex: 1;
    gap: 10px;
    overflow-wrap: anywhere;
}
.reply-icon img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}
.reply-body {
    flex: 1;
}
.reply-text {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.reply-meta {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}
.cancel-reply {
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
}
/*.textarea-container.with-reply #.message-input-block {*/
/*    border-top: 1px solid;*/
/*}*/
/*#.message-input-block {*/
/*    width: 100%;*/
/*    !*padding: 10px;*!*/
/*    box-sizing: border-box;*/
/*    resize: none;*/
/*    border: 1px solid #ccc;*/
/*    border-radius: 0 0 4px 4px;*/
/*    font-size: 14px;*/
/*    min-height: 40px;*/
/*    overflow-y: auto;*/
/*}*/

.message-input-container .attachment-preview, .message-input-container .order-preview {
    border-bottom: 1px solid #ccc;
}
.attachment-preview, .order-preview {
    display: flex;
    width: calc(100% - 2rem);
    flex-wrap:wrap;
    /*overflow-x: auto;*/
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 6px;
    min-width: 100%;
}
.attachment-item a {
    width: 100%;
}
#mini-chat-popup .attachment-preview .attachment-item {
    min-width: 60px;
    max-width: 120px;
}
.attachment-preview .attachment-item {
    background: #eee;
    padding: 6px;
    border-radius: 6px;
    font-size: 13px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    max-width: 240px;
}
#mini-chat-popup .attachment-preview .attachment-thumb {
    height: 64px;
}
.attachment-thumb {
    width: 100%;
    height: 128px;
    object-fit: contain;
    border-radius: 4px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.attachment-meta {
    text-align: left;
    font-size: 12px;
    color: #333;
    margin-top: 6px;
    max-width: 100%;
}


.attachment-meta .attachment-name {
    font-weight: bold;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.attachment-meta .attachment-info {
    font-size: 11px;
    color: #666;
}

.attachment-preview .remove-attach {
    font-weight: bold;
    background: none;
    border: none;
    mix-blend-mode: difference;
    color: white;
    font-size: 16px;
    cursor: pointer;
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: #00000066;
    border-radius: 50%;
}
.chat-filters {
    display: flex;
    padding: 10px;
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
    flex-wrap: wrap;
}

.data {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.chat-header__top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-header__meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #555;
}

.chat-name {
    font-weight: bold;
    font-size: 1rem;
}

.chat-balance {
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
}
.chat-balance:hover {
    color: #1a73e8;
    text-shadow: 0 0 5px rgba(26, 115, 232, 0.3);
}

.chat-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    transition: color 0.2s ease;
    outline: none !important;
}

.chat-phone:hover {
    color: #2e7d32;
}

.chat-phone i {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.balance-tooltip {
    position: absolute;
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    white-space: pre-line;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.balance-tooltip.show {
    opacity: 1;
    transform: translateY(0);
    display: block !important;
}
.balance-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
}
.balance-tooltip.top::after {
    top: -12px;
    border-bottom-color: #ccc;
}
.balance-tooltip.bottom::after {
    bottom: -12px;
    border-top-color: #ccc;
}
@keyframes bgBlink {
    0%   {
        background-color: red;
    }
    50%  {
        background-color: white;
    }
    100% {
        background-color: red;
    }
}

.bg-blink {
    animation: bgBlink 1s infinite;
}

@keyframes pulseRed {
    0% {
        background-color: red;
        color: white;
    }
    50% {
        background-color: #ffcccc;
        color: #000000;
    }
    100% {
        color: white;
        background-color: red;
    }
}

.bg-pulse {
    animation: pulseRed 1.2s infinite;
    position: relative;
}
.NewMesssage:before {
    content: "";
    position: absolute;
    /* bottom: -4px; */
    /* CONTAIN-INTRINSIC-BLOCK-SIZE: AUTO 100PX; */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    /* border: 2px solid white; */
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-color: #ff0000;
}
#custom-notify {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 99999;
    width: 300px;
    max-width: 90%;
    font-family: Arial, sans-serif;
    cursor: pointer;
}
#notify-close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}
.btn-detach-chat, .btn-search-in-chat, .btn-deattach-chat {
    background: none;
    border: none;
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 18px;
    cursor: pointer;
}
.chat-btn-in-header:focus,
.chat-btn-in-header:active {
    outline: none;
}
.bubble-typing {
    background-color: #f1f1f1;
    padding: 0px 12px;
    border-radius: 16px;
    max-width: 100%;
    margin-left: 10px;
}
.bubble-typing .message-data {
    /*display: block;*/
    /*justify-content: center; !* Горизонтальне центрування *!*/
    /*align-items: center;     !* Вертикальне центрування *!*/
    height: 100%;            /* Щоб працювало вертикальне центрування */
    min-height: 30px;        /* Або більше, якщо треба */
}

.typing-dots {
    /*display: inline-flex;*/
    gap: 4px;
    font-size: 20px;
    color: #252525;
    animation: blink 1.5s infinite;
}

.typing-dots span {
    animation: blinkDot 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blinkDot {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}
.bubble-typing {
    background: linear-gradient(270deg, #e0e0e0, #d6d6ff, #cfe6ff, #e0e0e0);
    background-size: 400% 400%;
    animation: bubbleTypingFlow 6s ease infinite;
    border-radius: 18px; /* для м'яких країв */
}

@keyframes bubbleTypingFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}


.attach-order-btn {
    right: 36px;
    /*background-position: 0 0;*/
    /* position: absolute; */
    /*width: 16px;*/
    /*height: 16px;*/
    /* left: 12px; */
    /* top: 11px; */
    /*background-repeat: no-repeat;*/
    /*background-image: url(../images/nav-icon.png);*/
    /* background: transparent; */
    /*border: none;*/
}

.chat-order-preview {
    border: 1px solid #ddd;
    border-left: 4px solid #007bff;
    padding: 12px;
    border-radius: 6px;
    margin: 6px 0;
    background: #f9f9f9;
    font-family: Arial, sans-serif;
    font-size: 13px;
    max-width: 400px;
    min-width: 30px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-id {
    font-weight: bold;
    /*font-size: 14px;*/
}

.order-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.order-client {
    margin-top: 4px;
    font-size: 12px;
    color: #555;
}

.order-client a {
    color: #007bff;
    text-decoration: none;
}

.client-role {
    color: #999;
}

.order-item {
    margin-top: 8px;
    display: flex;
}

.item-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-right: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    color: #555;
}

.item-price {
    color: #999;
}

.order-total {
    margin-top: 10px;
    text-align: right;
    font-weight: bold;
    color: #333;
}
.order-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    /* margin: 6px 0; */
    margin-left: -8px;
    margin-top: -18px;
}

.order-flag {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px #aaa;
    cursor: default;
}
.chat-order-preview .hidden-order-item {
    display: none;
}

.chat-order-preview .hidden-order-item.shown {
    display: flex;
}

.toggle-items-btn {
    background: none;
    color: #007bff;
    border: none;
    cursor: pointer;
    margin: 4px 0;
    font-size: 13px;
    padding: 4px 0;
}

.toggle-items-btn:hover {
    text-decoration: underline;
}
.order-id.clickable {
    cursor: pointer;
    text-decoration: underline dotted;
}
.order-id.clickable:hover {
    color: #007bff;
}
.chat-unread-divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
    font-size: 13px;
    font-weight: bold;
    color: #999;
}
.chat-unread-divider::before,
.chat-unread-divider::after {
    content: '';
    position: relative;
    top: 0em;
    display: inline-block;
    width: 20%;
    height: 1px;
    background-color: #ccc;
    vertical-align: middle;
    margin: 0 10px;
}
.message-list.dragover {
    border: 2px dashed #4489ff;
    background-color: rgba(68,137,255,0.1);
}
a.tmp:hover {
    text-decoration: none;
}
.btn-search-in-chat {
    position: absolute;
    right: 66px;
    top: 10px;
    width: auto;
}
.btn-deattach-chat {
    position: absolute;
    right: 36px;
    top: 10px;
    width: auto;
}
/*.btn-search-in-chat svg {*/
/*    width: 22px;*/
/*    color:#000;*/
/*}*/
.chat-panel-right {
    /*position: fixed;*/
    /*top: 0;*/
    /*right: -400px; !* ширина панелі + запас *!*/
    width: 0px;
    min-width: 0px  ;
    /*height: 100%;*/
    background: #fff;
    /*box-shadow: -2px 0 8px rgba(0,0,0,0.2);*/
    transition: width 0.3s ease; /* плавність виїзду */
    /*z-index: 1000;*/
    max-height: 100vh;
}
.chat-panel-right.active {
    width: 25%; /* виїжджає */
    min-width: 25%;
    border-left: 1px solid #ddd;
    /*padding: 1rem;*/
}
.chat-panel-content {
    opacity: 0;
    transition: opacity 0.3s ease;
    transition-delay: 0s; /* Спочатку приховано */
    /*padding: 20px;*/
}
.chat-panel-right.active .chat-panel-content {
    opacity: 1;
    transition-delay: 0.3s; /* Показуємо контент після розкриття панелі */
    padding: 20px;
}
/*.chat-message {*/
/*    display: flex;*/
/*    gap: 10px;*/
/*    padding: 6px 0;*/
/*    border-bottom: 1px solid #eee;*/
/*}*/

/*.chat-message img {*/
/*    width: 32px;*/
/*    height: 32px;*/
/*    border-radius: 50%;*/
/*    object-fit: cover;*/
/*}*/

/*.chat-message .text {*/
/*    flex: 1;*/
/*}*/
.search-result {
    max-height: calc(100vh - 150px); /* відняти хедер + інпут */
    overflow-y: auto;
}
/*.chat-message .text {*/
/*    display: -webkit-box;*/
/*    -webkit-line-clamp: 3; !* максимум 3 рядки *!*/
/*    -webkit-box-orient: vertical;*/
/*    overflow: hidden;*/
/*    text-overflow: ellipsis;*/
/*    white-space: normal; !* дозволяє перенос *!*/
/*    word-break: break-word; !* перенос довгих слів *!*/
/*}*/
/*.chat-message:hover {*/
/*    background: #f1f1f1;*/
/*    cursor: pointer;*/
/*}*/

.chat-message {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    max-width: 600px;
    background: #fff;
    transition: background 0.2s ease;
}

.chat-message:hover {
    background: #f1f1f1;
    cursor: pointer;
}

.chat-message img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #ccc60f;
}

.chat-message .text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    /*font-size: 14px;*/
    color: #333;
}
.bottom-controls {
    display: flex;
}

.chat-message .content {
    flex: 1;
}

.chat-message .meta {
    display: flex;
    justify-content: space-between;
    /*font-size: 14px;*/
}

.message-time {
    color: #777;
}

#tab-attachments .attachments-scroll {  overflow-y:auto; min-height:0; max-height:calc(100vh - 200px); }

/* Ґрід 2 в ряд */
.attaches-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 10px;
}

.attach-item {
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

/* прев’ю: для зображень – картинка, для файлів – іконка по центру */
.attach-item .preview {
    display: flex; align-items: center; justify-content: center;
    background: #fafafa; height: 140px;
}
.attach-item .preview img.preview-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.attach-item .preview img.preview-icon {
    width: 42px; height: 42px; display: block; opacity: .8;
}

.attach-item .meta {
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
}
.attach-item .meta .name {
    display: -webkit-box;
    -webkit-line-clamp: 2;        /* до 2 рядків */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}
.attach-item .meta .size {
    color: #666;
}
/*.attachments-result {*/
/*    max-height: 100vh;*/
/*}*/


#tab-orders .orders-scroll { flex:1 1 auto; overflow-y:auto; min-height:0; max-height:calc(100vh - 200px); }

/* Ґрід 1 в ряд */
.orders-list {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 10px;
}

.attach-btn-to-chat {
    color: #fff;
    background: linear-gradient(135deg, #4489ff, #0066ff);
    padding: 0.5rem 1.2rem;
    border-radius: 36px;
    margin: auto;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 102, 255, 0.3);
    transition: all 0.25s ease;
    margin-bottom: .5rem;
}

/* Ефект при наведенні */
.attach-btn-to-chat:hover {
    background: linear-gradient(135deg, #5599ff, #1a75ff);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 102, 255, 0.4);
}

/* Ефект при кліку */
.attach-btn-to-chat:active {
    transform: translateY(0);
    box-shadow: 0 3px 6px rgba(0, 102, 255, 0.3);
}
/*#mini-chat-popup .attach-btn-to-chat{*/

/*}*/

/* Дрібні контури вищої щільності */


/* Грубе наближення: Retina (2dppx) + "очікувана" ширина при 100% */
#mini-chat-popup {
    position: fixed;
    bottom: 20px;
    right: 30px;
    width: 560px;
    font-size: 14px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    /*max-height: 600px;*/
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    font-family: Arial, sans-serif;
}
#mini-chat-popup.dark {
    background: #2b2b2b;
    color: #ddd;
}
.mini-chat-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    background: #007bff;
    color: white;
}
.mini-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}
.mini-chat-user {
    display: flex;
    align-items: center;
    flex-grow: 1;
}
.mini-chat-username {
    font-weight: bold;
}
.mini-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.mini-emoji-popup {
    position: absolute !important;
    bottom: 40px;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 8px;
    max-width: 250px !important;
    max-height: 200px;
    /*overflow-x: unset;*/
    overflow-y: auto;
    white-space: normal !important;
    z-index: 100050 !important;
    /*display: none;*/
}
.mini-emoji-popup img {
    width: 28px;
    height: 28px;
    cursor: pointer;
}