/* BF1: constrain bubbles to their grid track, including long text and receipt cards. */
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system){box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important;grid-template-columns:48px minmax(0,1fr)!important;column-gap:8px!important;padding:0 24px 0 0!important;direction:ltr!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message.own:not(.system){grid-template-columns:minmax(0,1fr) 48px!important;padding:0 0 0 24px!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system)>.staff-message-bubble{position:relative!important;box-sizing:border-box!important;min-width:0!important;width:fit-content!important;max-width:min(100%,480px)!important;justify-self:start!important;overflow-wrap:anywhere;direction:rtl;border-bottom-left-radius:4px!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message.own:not(.system)>.staff-message-bubble{justify-self:end!important;border-bottom-left-radius:15px!important;border-bottom-right-radius:4px!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system):has([data-rc-message])>.staff-message-bubble{width:320px!important;max-width:100%!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system)>.staff-message-avatar{width:48px!important;height:48px!important;min-width:48px!important;flex-basis:48px!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system)>.staff-message-bubble::before{content:none!important}
body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system)>.staff-message-bubble::after{content:""!important;position:absolute!important;inset:auto!important;left:-7px!important;bottom:0!important;width:12px!important;height:13px!important;background:inherit!important;border:0!important;box-shadow:none!important;transform:none!important;clip-path:polygon(100% 0,100% 100%,0 100%,45% 65%)!important;pointer-events:none}
body.staff-chat-active .staff-chat-page .staff-message.staff-message.own:not(.system)>.staff-message-bubble::after{left:auto!important;right:-7px!important;transform:scaleX(-1)!important}
body.staff-chat-active .staff-chat-page .staff-message.sc-has-next:not(.rc-operator-message)>.staff-message-bubble::after{content:none!important}
body.staff-chat-active .staff-chat-page .staff-message-bubble>.staff-message-body{min-width:0;max-width:100%;overflow-wrap:anywhere}

@media(max-width:360px){
body.staff-chat-active .staff-chat-page .rc-order-with-thumbnail{display:grid!important;grid-template-columns:minmax(0,1fr)!important}
body.staff-chat-active .staff-chat-page .rc-order-with-thumbnail .rc-image-button{width:70px!important;max-width:100%!important;justify-self:start}
body.staff-chat-active .staff-chat-page .seller-receipt-image-person .rc-profile-avatar{width:52px!important;height:52px!important;max-width:100%!important}
}

body.staff-chat-active .staff-chat-page .staff-message.staff-message:not(.system)>.staff-message-avatar{box-sizing:border-box!important;border:1.5px solid rgba(255,255,255,.96)!important;padding:0!important;box-shadow:0 2px 6px #16566b18!important;overflow:hidden!important;border-radius:50%!important}

/* CT1: outgoing bubbles keep their wall-facing tail, including consecutive messages. */
body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.system):not(.pv2-photo-message)>.staff-message-bubble{overflow:visible!important;border-bottom-right-radius:4px!important}
body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.system):not(.pv2-photo-message)>.staff-message-bubble::after{content:""!important;display:block!important;position:absolute!important;inset:auto!important;left:auto!important;right:-8px!important;bottom:0!important;width:13px!important;height:16px!important;background:inherit!important;border:0!important;box-shadow:none!important;transform:none!important;clip-path:polygon(0 0,30% 0,33% 28%,43% 53%,60% 75%,80% 91%,100% 100%,0 100%)!important;pointer-events:none}
body.staff-chat-active #app .staff-chat-page .staff-message.own.pv2-photo-message .staff-message-photo::after{content:""!important;display:block!important;position:absolute!important;left:auto!important;right:-8px!important;bottom:0!important;width:13px!important;height:16px!important;background:#fff!important;transform:none!important;clip-path:polygon(0 0,30% 0,33% 28%,43% 53%,60% 75%,80% 91%,100% 100%,0 100%)!important;pointer-events:none}
body.staff-chat-active #app .staff-chat-page .staff-message.own.pv2-photo-message .staff-message-photo>.staff-message-media-item{border-bottom-right-radius:4px!important}

/* PM1: photo metadata stays inside the image; reset the ordinary bubble offset. */
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message .staff-message-photo>.staff-message-time.cm-meta{position:absolute!important;inset:auto 8px 8px auto!important;transform:none!important;translate:none!important;margin:0!important;padding:4px 8px!important;width:max-content!important;max-width:calc(100% - 16px)!important;box-sizing:border-box!important;border-radius:16px!important;background:rgba(35,43,51,.43)!important;color:#fff!important;font-size:12px!important;line-height:16px!important;z-index:3!important;pointer-events:none!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message .staff-message-photo>.cm-meta .cm-views,body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message .staff-message-photo>.cm-meta .ds-status{color:#fff!important}

/* CBT1: captioned photos use the whole message bubble as the tail anchor. */
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble:has(>.staff-message-body)>.staff-message-photo::after{content:none!important;display:none!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble:has(>.staff-message-body)>.staff-message-photo>.staff-message-media-item{border-radius:16px!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message:not(.own)>.staff-message-bubble:has(>.staff-message-body){border-bottom-left-radius:4px!important;overflow:visible!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.own>.staff-message-bubble:has(>.staff-message-body){border-bottom-right-radius:4px!important;overflow:visible!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message:not(.own):not(.sc-has-next)>.staff-message-bubble:has(>.staff-message-body)::after{content:""!important;display:block!important;position:absolute!important;inset:auto!important;left:-7px!important;bottom:0!important;width:15px!important;height:17px!important;background:inherit!important;border:0!important;box-shadow:none!important;transform:none!important;clip-path:polygon(50% 0,65% 60%,100% 100%,0 100%,35% 72%)!important;pointer-events:none!important;z-index:0}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.own>.staff-message-bubble:has(>.staff-message-body)::after{content:""!important;display:block!important;position:absolute!important;inset:auto!important;right:-8px!important;bottom:0!important;width:13px!important;height:16px!important;background:inherit!important;border:0!important;box-shadow:none!important;transform:none!important;clip-path:polygon(0 0,30% 0,33% 28%,43% 53%,60% 75%,80% 91%,100% 100%,0 100%)!important;pointer-events:none!important;z-index:0}

/* PIM1: captions retain sender identity; photo metadata follows the rendered image. */
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble:has(>.staff-message-body)>.staff-message-name{display:flex!important;justify-content:space-between;align-items:flex-start;gap:6px}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble>.staff-message-photo{width:fit-content!important;max-width:100%!important;margin-inline:auto!important;position:relative!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble>.staff-message-photo>.staff-message-media-item{width:fit-content!important;max-width:100%!important;margin-inline:auto!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message>.staff-message-bubble>.staff-message-photo>.staff-message-time.cm-meta{inset:auto 8px 8px auto!important;max-width:calc(100% - 16px)!important;min-width:0!important;overflow:hidden!important;white-space:nowrap!important;line-height:16px!important;transform:none!important;translate:none!important}

/* PC2: lazy photo frames need an intrinsic width inside fit-content wrappers.
   Absolutely positioned images cannot supply it; percentage widths collapsed to zero. */
body.staff-chat-active #app .staff-chat-page .staff-message-photo .staff-message-media-item>.sl-media-frame:has(>img){width:min(340px,calc(min(320px,45svh) * var(--sc-photo-ratio,1.333333)))!important;max-width:100%!important;flex:none!important;min-width:0!important}
body.staff-chat-active #app .staff-chat-page .staff-message-photo .staff-message-media-item>.sl-media-frame>img{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important}

/* DV2: deleted-media audit cards are complete bubbles, not photo-only overlays. */
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit>.staff-message-bubble{
 display:flex!important;flex-direction:column!important;gap:0!important;background:#fff!important;color:#163e4e!important;
 padding:10px!important;border:1px solid #d5eaf0!important;border-radius:16px!important;box-shadow:0 2px 6px #16566b12!important;overflow:visible!important;isolation:isolate;
}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit>.staff-message-bubble>.staff-message-name{
 display:flex!important;position:static!important;align-self:stretch!important;justify-content:space-between!important;align-items:flex-start!important;gap:8px!important;background:none!important;color:#237f9b!important;padding:0 0 8px!important;margin:0!important;pointer-events:auto!important;
}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .chat-sender-name-nr1{color:#237f9b!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .chat-sender-role-nr1{color:#637d88!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-photo{align-self:center!important;border-radius:12px!important;overflow:hidden!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-photo::after{display:none!important;content:none!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit>.staff-message-bubble>.staff-message-time{
 position:static!important;inset:auto!important;transform:none!important;translate:none!important;align-self:flex-end!important;max-width:100%!important;width:auto!important;margin:6px 0 0!important;padding:0!important;background:none!important;color:#647d88!important;border-radius:0!important;white-space:normal!important;
}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-delete-audit{align-self:stretch!important;margin:10px 0 0!important;padding:8px 10px!important;border:1px solid #ead9d5!important;border-radius:9px!important;background:#fff5f1!important;color:#8b5b50!important;overflow-wrap:anywhere!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-body{color:#163e4e!important}

body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-photo .staff-message-media-item>.sl-media-frame:has(>img){width:fit-content!important;height:auto!important;aspect-ratio:auto!important;max-width:100%!important;display:flex!important;justify-content:center!important}
body.staff-chat-active #app .staff-chat-page .staff-message.deleted-audit .staff-message-photo .staff-message-media-item>.sl-media-frame>img{position:static!important;inset:auto!important;display:block!important;width:auto!important;height:auto!important;max-width:100%!important;max-height:min(320px,45svh)!important;object-fit:contain!important}

/* PF3: shared photo bubble contract, for every room and private conversation.
   PH1's transparent grid/overlaid identity is incompatible with lazy images,
   captions, forwarded headers and audit notices. Keep all content in flow. */
body.staff-chat-active #app .staff-chat-page .staff-message>.staff-message-bubble:has(>.staff-message-photo){display:flex!important;flex-direction:column!important;gap:0!important;padding:10px!important;background:#fff!important;color:#163e4e!important;border:1px solid #d5eaf0!important;border-radius:16px!important;box-shadow:0 2px 6px #16566b12!important;overflow:visible!important;isolation:isolate}
body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.deleted-audit)>.staff-message-bubble:has(>.staff-message-photo){background:#1485a0!important;color:#fff!important;border-color:#1485a0!important}
body.staff-chat-active #app .staff-chat-page .staff-message>.staff-message-bubble:has(>.staff-message-photo)>.staff-message-name{display:flex!important;position:static!important;align-self:stretch!important;justify-content:space-between!important;align-items:flex-start!important;gap:8px!important;background:none!important;color:#237f9b!important;padding:0 0 8px!important;margin:0!important;pointer-events:auto!important}
body.staff-chat-active #app .staff-chat-page .staff-message:not(.own)>.staff-message-bubble:has(>.staff-message-photo) .chat-sender-name-nr1{color:#237f9b!important}
body.staff-chat-active #app .staff-chat-page .staff-message:not(.own)>.staff-message-bubble:has(>.staff-message-photo) .chat-sender-role-nr1{color:#637d88!important}
body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.deleted-audit)>.staff-message-bubble:has(>.staff-message-photo)>.staff-message-name,body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.deleted-audit)>.staff-message-bubble:has(>.staff-message-photo) .chat-sender-name-nr1,body.staff-chat-active #app .staff-chat-page .staff-message.own:not(.deleted-audit)>.staff-message-bubble:has(>.staff-message-photo) .chat-sender-role-nr1{color:#fff!important}
body.staff-chat-active #app .staff-chat-page .staff-message>.staff-message-bubble>.staff-message-photo{align-self:center!important;border-radius:12px!important;overflow:hidden!important}
body.staff-chat-active #app .staff-chat-page .staff-message>.staff-message-bubble>.staff-message-photo::after{display:none!important;content:none!important}
body.staff-chat-active #app .staff-chat-page .staff-message-photo .staff-message-media-item>.sl-media-frame:has(>img){width:fit-content!important;height:auto!important;aspect-ratio:auto!important;max-width:100%!important;display:flex!important;justify-content:center!important;background:#e7f3f7!important}
body.staff-chat-active #app .staff-chat-page .staff-message-photo .staff-message-media-item>.sl-media-frame>img{position:static!important;inset:auto!important;display:block!important;width:auto!important;height:auto!important;max-width:100%!important;max-height:min(320px,45svh)!important;object-fit:contain!important}
body.staff-chat-active #app .staff-chat-page .staff-message>.staff-message-bubble:has(>.staff-message-photo)>.staff-message-time{position:static!important;inset:auto!important;transform:none!important;translate:none!important;align-self:flex-end!important;max-width:100%!important;width:auto!important;margin:6px 0 0!important;padding:0!important;background:none!important;color:inherit!important;border-radius:0!important;white-space:normal!important}

/* CM4: captioned image metadata belongs below its caption, not over the photo. */
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta>.staff-message-bubble>.staff-message-time.cm-meta{position:static!important;inset:auto!important;transform:none!important;translate:none!important;display:flex!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;clear:both!important;margin:6px 0 0!important;padding:0!important;background:transparent!important;border-radius:0!important;color:#738b95!important;line-height:16px!important;overflow:visible!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta>.staff-message-bubble .cm-meta .cm-views,body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta>.staff-message-bubble .cm-meta .ds-status{color:inherit!important}
body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta.own>.staff-message-bubble>.cm-meta,body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta.founder-message-fv1>.staff-message-bubble>.cm-meta{color:rgba(255,255,255,.85)!important}

body.staff-chat-active #app .staff-chat-page .staff-message.pv2-photo-message.cm4-caption-meta:not(.own):not(.founder-message-fv1)>.staff-message-bubble .cm-meta{color:#738b95!important}
