body {
    margin: 0;
    background: #eef1f4;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.chat-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: 340px 1fr;
    background: #f4f6f8;
}

.contacts-panel {
    background: #ffffff;
    border-left: 1px solid #ddd;
    padding: 20px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #25d366;
    color: white;
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: 22px;
}

.brand h3 {
    margin: 0;
}

.brand span {
    color: #777;
    font-size: 13px;
}

.contact {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    cursor: pointer;
}

.contact.active {
    background: #e8f7ee;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #d9efe2;
    color: #128c7e;
    display: grid;
    place-items: center;
    font-weight: bold;
}

.contact small {
    display: block;
    color: #777;
    margin-top: 4px;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    height: 78px;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 0 24px;
    display: flex;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
}

.online {
    color: #0b9f42;
    font-size: 13px;
}

.offline {
    color: #c62828;
    font-size: 13px;
}

.messages-box {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #efeae2;
}

.message-row {
    display: flex;
    margin-bottom: 12px;
}

.message-row.in {
    justify-content: flex-start;
}

.message-row.out {
    justify-content: flex-end;
}

.bubble {
    max-width: 60%;
    padding: 12px 14px;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

.message-row.in .bubble {
    background: #ffffff;
    border-top-right-radius: 4px;
}

.message-row.out .bubble {
    background: #d9fdd3;
    border-top-left-radius: 4px;
}

.bubble p {
    margin: 0 0 6px 0;
    line-height: 1.7;
}

.bubble small {
    color: #777;
    font-size: 11px;
}

.send-box {
    height: 76px;
    background: #ffffff;
    border-top: 1px solid #ddd;
    padding: 14px;
    display: flex;
    gap: 12px;
}

.send-box input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 0 18px;
    font-size: 15px;
    outline: none;
}

.send-box button {
    width: 120px;
    border: 0;
    border-radius: 18px;
    background: #25d366;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.send-box button:disabled {
    background: #b7b7b7;
    cursor: not-allowed;
}


.msg-link {
    color: #0576d8;
    text-decoration: none;
    direction: ltr;
    display: inline-block;
    font-weight: 500;
}

.msg-link:hover {
    text-decoration: underline;
}

.link-preview {
    display: block;
    margin-top: 10px;
    background: #f3f4f5;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: #111;
    border: 1px solid #ddd;
    max-width: 360px;
}

.link-preview img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    display: block;
}

.link-preview div {
    padding: 10px;
}

.link-preview strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.link-preview span {
    display: block;
    color: #666;
    font-size: 12px;
    line-height: 1.5;
}

.link-preview small {
    display: block;
    color: #999;
    margin-top: 6px;
}


.form-box {
    background: #f7f7f7;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 18px;
}

.form-box label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.form-box small {
    display: block;
    color: #777;
    margin-top: 6px;
    font-size: 12px;
}

.group-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px;
    direction: ltr;
}

.sender-name {
    display: block;
    color: #128c7e;
    font-weight: bold;
    margin-bottom: 5px;
}

.msg-link {
    color: #0576d8;
    text-decoration: none;
    direction: ltr;
    display: inline-block;
    font-weight: 500;
}

.msg-link:hover {
    text-decoration: underline;
}


.contact-info {
    min-width: 0;
}

.contact-info strong,
.contact-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.small-btn {
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: #25d366;
    color: white;
    padding: 10px;
    font-weight: bold;
    margin-top: 8px;
    cursor: pointer;
}

.rename-box {
    margin-inline-start: auto;
    display: flex;
    gap: 8px;
}

.rename-box input {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 8px 12px;
}

.rename-box button {
    border: 0;
    border-radius: 12px;
    padding: 8px 14px;
    background: #128c7e;
    color: white;
    cursor: pointer;
}


.search-row {
    display: flex;
    gap: 8px;
}

.search-results {
    margin-top: 10px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 14px;
    background: white;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}

.search-item:hover {
    background: #e8f7ee;
}

.search-item small {
    display: block;
    color: #777;
    direction: ltr;
    font-size: 11px;
    margin-top: 3px;
}

.form-box hr {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 14px 0;
}
