.ziper-chat {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1040;
    font-family: 'Nunito Sans', sans-serif;
}

.ziper-notifications {
    position: relative;
}

.ziper-notifications-toggle {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 1.05rem;
}

.ziper-notifications-toggle:hover,
.ziper-notifications.open .ziper-notifications-toggle {
    background: rgba(255, 255, 255, .18);
}

.ziper-notifications-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border: 2px solid #1f2937;
    font-size: .66rem;
    font-weight: 800;
    line-height: 1;
}

.ziper-notifications-panel {
    position: fixed;
    top: 58px;
    right: 18px;
    width: min(360px, calc(100vw - 24px));
    max-height: min(520px, calc(100dvh - 76px));
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: none;
    overflow: hidden;
    background: #fff;
    color: #111827;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    z-index: 1050;
}

.ziper-notifications.open .ziper-notifications-panel {
    display: block;
}

.ziper-notifications-header {
    height: 58px;
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eef2f7;
}

.ziper-notifications-header strong,
.ziper-notifications-header span {
    display: block;
}

.ziper-notifications-header strong {
    font-size: .98rem;
    color: #111827;
}

.ziper-notifications-header span {
    font-size: .76rem;
    color: #6b7280;
}

.ziper-notifications-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
}

.ziper-notifications-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.ziper-notifications-empty {
    min-height: 202px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6b7280;
    text-align: center;
}

.ziper-notifications-empty i {
    font-size: 2rem;
    color: #9ca3af;
}

.ziper-notifications-actions {
    min-height: 42px;
    padding: 8px 12px;
    display: flex;
    justify-content: flex-end;
    border-bottom: 1px solid #eef2f7;
    background: #fbfcff;
}

.ziper-notifications-actions button {
    border: 0;
    border-radius: 8px;
    padding: 6px 9px;
    background: transparent;
    color: #584DFD;
    font-size: .78rem;
    font-weight: 800;
}

.ziper-notifications-actions button:hover {
    background: #f1f4ff;
}

.ziper-notifications-list {
    max-height: calc(min(520px, calc(100dvh - 76px)) - 100px);
    overflow-y: auto;
}

.ziper-notification-item {
    width: 100%;
    min-height: 76px;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 10px;
    gap: 10px;
    align-items: center;
    background: #fff;
    text-align: left;
}

.ziper-notification-item:hover {
    background: #f8fafc;
}

.ziper-notification-item.unread {
    background: #f7f8ff;
}

.ziper-notification-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ziper-notification-icon.chat {
    background: #584DFD;
}

.ziper-notification-icon.reward {
    background: #10b981;
}

.ziper-notification-icon.info {
    background: #f59e0b;
}

.ziper-notification-content {
    min-width: 0;
}

.ziper-notification-content strong,
.ziper-notification-content span,
.ziper-notification-content small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ziper-notification-content strong {
    color: #111827;
    font-size: .86rem;
    font-weight: 800;
}

.ziper-notification-content span {
    color: #4b5563;
    font-size: .78rem;
}

.ziper-notification-content small {
    margin-top: 2px;
    color: #9ca3af;
    font-size: .7rem;
}

.ziper-notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.ziper-chat-toast-stack {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: min(360px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    z-index: 1045;
}

.ziper-chat-toast {
    min-height: 72px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 10px 10px 12px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 28px;
    gap: 10px;
    align-items: center;
    background: #fff;
    color: #111827;
    box-shadow: 0 18px 46px rgba(15, 23, 42, .16);
    pointer-events: auto;
    animation: ziperChatToastIn .18s ease-out;
}

.ziper-chat-toast img,
.ziper-chat-toast .ziper-chat-avatar-fallback {
    width: 36px;
    height: 36px;
}

.ziper-chat-toast-content {
    min-width: 0;
}

.ziper-chat-toast-title {
    font-size: .88rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ziper-chat-toast-message {
    margin-top: 2px;
    color: #6b7280;
    font-size: .78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ziper-chat-toast-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
}

.ziper-chat-toast-close:hover {
    background: #f3f4f6;
    color: #111827;
}

@keyframes ziperChatToastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ziper-chat-toggle {
    position: relative;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: #584DFD;
    box-shadow: 0 14px 28px rgba(88, 77, 253, .28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.ziper-chat-toggle:hover {
    background: #473ee7;
}

.ziper-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 16px;
}

.ziper-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: min(760px, calc(100vw - 32px));
    height: min(560px, calc(100dvh - 116px));
    max-height: 560px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    overflow: hidden;
    display: none;
}

.ziper-chat.open .ziper-chat-panel {
    display: flex;
    flex-direction: column;
}

.ziper-chat-header {
    height: 58px;
    flex: 0 0 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 16px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.ziper-chat-header strong {
    display: block;
    color: #111827;
    font-size: 1rem;
}

.ziper-chat-header span {
    display: block;
    color: #6b7280;
    font-size: .78rem;
}

.ziper-chat-icon-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4b5563;
}

.ziper-chat-icon-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.ziper-chat-body {
    min-height: 0;
    flex: 1;
    display: grid;
    grid-template-columns: 240px 1fr;
}

.ziper-chat-users {
    border-right: 1px solid #eef2f7;
    background: #fbfcff;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ziper-chat-users-title {
    color: #6b7280;
    font-size: .78rem;
    font-weight: 700;
    padding: 12px 12px 8px;
    text-transform: uppercase;
}

.ziper-chat-search {
    height: 38px;
    margin: 0 10px 10px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
}

.ziper-chat-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #111827;
    font-size: .84rem;
}

.ziper-chat-search input::placeholder {
    color: #9ca3af;
}

.ziper-chat-users-list {
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 10px;
}

.ziper-chat-user {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px;
    text-align: left;
    position: relative;
}

.ziper-chat-user:hover,
.ziper-chat-user.active {
    background: #f1f4ff;
}

.ziper-chat-user img,
.ziper-chat-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ziper-chat-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #584DFD;
    color: #fff;
    font-weight: 700;
}

.ziper-chat-user-name {
    color: #111827;
    font-size: .9rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ziper-chat-user-meta {
    color: #10b981;
    font-size: .75rem;
}

.ziper-chat-user-meta.offline {
    color: #9ca3af;
}

.ziper-chat-user-content {
    min-width: 0;
}

.ziper-chat-user-badge {
    position: absolute;
    top: 7px;
    right: 8px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1;
}

.ziper-chat-room {
    min-width: 0;
    min-height: 0;
    background: #fff;
}

.ziper-chat-room-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6b7280;
    text-align: center;
}

.ziper-chat-room-empty i {
    font-size: 2rem;
    color: #9ca3af;
}

.ziper-chat-room-content {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ziper-chat-room-title {
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid #eef2f7;
    color: #111827;
    font-weight: 800;
}

.ziper-chat-room-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ziper-chat-room-close {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #4b5563;
}

.ziper-chat-room-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.ziper-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
}

.ziper-chat-message {
    display: flex;
    margin-bottom: 10px;
}

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

.ziper-chat-bubble {
    max-width: min(78%, 420px);
    padding: 9px 11px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #111827;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.ziper-chat-message.mine .ziper-chat-bubble {
    background: #584DFD;
    border-color: #584DFD;
    color: #fff;
}

.ziper-chat-bubble-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .92rem;
}

.ziper-chat-bubble-time {
    margin-top: 4px;
    font-size: .68rem;
    opacity: .75;
    text-align: right;
}

.ziper-chat-form {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 42px;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eef2f7;
    background: #fff;
}

.ziper-chat-input {
    min-width: 0;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
}

.ziper-chat-input:focus {
    border-color: #584DFD;
    box-shadow: 0 0 0 3px rgba(88, 77, 253, .12);
}

.ziper-chat-send {
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: #584DFD;
}

.ziper-chat-send:hover {
    background: #473ee7;
}

.ziper-chat-empty {
    color: #6b7280;
    font-size: .86rem;
    padding: 16px 8px;
    text-align: center;
}

@media (max-width: 640px) {
    .ziper-notifications-panel {
        position: fixed;
        top: 62px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    .ziper-chat-toast-stack {
        right: 14px;
        bottom: 84px;
        width: calc(100vw - 28px);
    }

    .ziper-chat {
        right: 14px;
        bottom: 14px;
    }

    .ziper-chat-panel {
        right: 10px;
        left: 10px;
        bottom: 82px;
        width: auto;
        height: min(620px, calc(100dvh - 104px));
    }

    .ziper-chat-body {
        grid-template-columns: 132px 1fr;
    }

    .ziper-chat-search {
        height: 34px;
        margin: 0 8px 8px;
        padding: 0 8px;
    }

    .ziper-chat-search input {
        font-size: .76rem;
    }

    .ziper-chat-user {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 8px;
        padding: 8px 7px;
    }

    .ziper-chat-user-name {
        font-size: .78rem;
    }

    .ziper-chat-user-meta {
        display: none;
    }

    .ziper-chat-user-badge {
        top: 5px;
        right: 6px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border: 2px solid #fbfcff;
        font-size: .66rem;
    }
}

@media (max-width: 460px) {
    .ziper-chat-panel {
        top: 10px;
        bottom: 82px;
        height: auto;
    }

    .ziper-chat-body {
        grid-template-columns: 1fr;
        grid-template-rows: 170px minmax(0, 1fr);
    }

    .ziper-chat-users {
        border-right: 0;
        border-bottom: 1px solid #eef2f7;
    }

    .ziper-chat-users-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 10px 10px;
    }

    .ziper-chat-user {
        width: 138px;
        flex: 0 0 138px;
    }
}

@media (max-height: 520px) {
    .ziper-chat-panel {
        top: 10px;
        bottom: 76px;
        height: auto;
    }

    .ziper-chat-header {
        height: 50px;
        flex-basis: 50px;
    }
}
