/* Patch 08: panels have explicit containment, scoped images and a messenger layout. */
.p8-hint{font-size:13px;color:var(--muted);line-height:1.5;margin:12px 0}
/* Rank thumbnails cannot inherit a product-photo size from another block. */
.a4-products .a4-product-image{position:relative!important;display:flex!important;flex:0 0 auto;align-items:center;justify-content:center;overflow:hidden!important;min-width:0!important;min-height:0!important;aspect-ratio:1;border-radius:7px;background:var(--surface)}
.a4-products .a4-product-image>img{position:absolute!important;inset:3px!important;width:calc(100% - 6px)!important;height:calc(100% - 6px)!important;min-width:0!important;min-height:0!important;max-width:calc(100% - 6px)!important;max-height:calc(100% - 6px)!important;object-fit:contain!important;object-position:center!important;display:block!important;transform:none!important;margin:0!important;padding:0!important}
.a4-product-name,.a4-product-sales{min-width:0;overflow:hidden}.a4-product-name b{overflow-wrap:anywhere}.a4-product-sales{white-space:nowrap}
.p8-rating{width:100%;min-height:30px;padding:5px 8px;display:flex;justify-content:space-between;gap:7px;background:var(--soft);border-color:transparent;font-size:12px;margin-bottom:6px}
.p8-rating span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p8-rating b{color:var(--accent);flex-shrink:0}
.p8-rating-details dl>div{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding:10px;gap:10px}.p8-rating-details dd{margin:0}.p8-rating-big{font-size:36px;color:var(--accent)}
.p8-geo-wrap{display:flex;align-items:center;gap:7px;min-width:0;flex:1;min-height:36px;overflow:hidden}.p8-geo-wrap>.a4-geo{min-width:0;flex:1}.p8-wa-mini{height:29px;width:29px;min-height:29px;padding:4px;flex-shrink:0;border:0;color:var(--accent)}
#p8-wa-text{width:100%;min-height:260px;font-size:14px;line-height:1.5;white-space:pre-wrap}#p8-wa-status{font-size:13px;margin-top:14px}
.p8-team-groups{display:grid;gap:14px}.p8-team-group{padding:18px}.p8-team-group>summary,.p8-admin-unit>summary{cursor:pointer;list-style:disclosure-closed;padding:8px;line-height:1.5}.p8-team-group[open]>summary,.p8-admin-unit[open]>summary{list-style:disclosure-open}
.p8-team-group>summary{display:flex;justify-content:space-between;gap:10px}.p8-team-group>summary span{font-size:13px;color:var(--muted)}
.p8-team-row{display:grid;grid-template-columns:minmax(170px,1.8fr) minmax(100px,1fr) 75px minmax(100px,1fr) 125px;gap:10px;align-items:center;border-top:1px solid var(--line);padding:11px 0;font-size:14px}.p8-team-row>span{min-width:0}.p8-team-row small{display:block}
.p8-person-link{display:block;text-align:left;background:transparent;border:0;padding:0;color:var(--ink)}.p8-person-link small{margin-top:4px}.p8-team-header{color:var(--muted);font-size:12px}
.p8-admin-tree{margin-top:16px}.p8-admin-unit{padding:6px 0 6px 14px;border-left:1px solid var(--line);margin:5px 0}.p8-admin-unit summary b{margin-left:6px}.p8-admin-unit summary small{margin-left:9px}.p8-admin-unit summary .svg{width:16px;height:16px;vertical-align:middle}
.p8-admin-person{display:flex;gap:14px;justify-content:space-between;align-items:center;border-top:1px solid var(--line);padding:12px 8px}.p8-admin-person>div{min-width:0}.p8-admin-person small{display:block;overflow-wrap:anywhere}.p8-admin-person .actions{flex-wrap:wrap}.p8-admin-person .actions button{font-size:12px}
/* New reading order is also DOM order: trend, TT categories, product / team, TOP, brands. */
@media(min-width:1180px) and (min-height:680px){
 .a7-compact .a6-dashboard{grid-template-columns:minmax(0,1.08fr) minmax(0,.94fr) minmax(0,1.18fr)!important}
 .a7-compact .a6-dashboard>.a4-channel-card{grid-area:1/2!important}.a7-compact .a6-dashboard>.p6-spotlight{grid-area:1/3!important}.a7-compact .a6-dashboard>.brand-panel{grid-area:2/3!important}
 .a7-compact .a6-dashboard>section{isolation:isolate;min-width:0!important;contain:layout}
 .a7-compact .a6-dashboard .p6-head{padding-right:24px;flex-shrink:0}.a7-compact .a6-dashboard .p6-body{flex:1;min-height:0!important;height:auto;overflow:hidden;grid-template-columns:minmax(95px,.8fr) minmax(0,1.2fr)!important}
 .a7-compact .a6-dashboard .p6-copy{min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column}
 .a7-compact .a6-dashboard .p8-rating{min-height:25px;max-height:25px;font-size:11px;padding:3px 5px;margin:2px 0 4px;flex-shrink:0}
 .a7-compact .a6-dashboard .p6-filter{font-size:11px;min-height:26px;max-height:28px;flex-shrink:0;padding:3px 6px}
 .a7-compact .a6-dashboard .p6-media{overflow:hidden!important;min-height:0!important;max-height:100%}.a7-compact .a6-dashboard .p6-media .p6-photo{height:100%!important;width:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important}
 .a7-compact .a6-dashboard .a4-product{min-height:36px;flex:1 0 36px;grid-template-columns:18px 30px minmax(0,1fr) minmax(65px,auto);overflow:hidden;align-items:center;padding:3px 0}
 .a7-compact .a6-dashboard .a4-product-image{width:30px!important;height:30px!important;max-width:30px!important;max-height:30px!important}
 .a7-compact .a6-dashboard .a4-product-list{overflow:hidden!important}.a7-compact .a6-dashboard .p8-geo-wrap>.a4-geo{font-size:12px}.a7-compact .a6-dashboard .p8-geo-wrap .a4-geo>strong{font-size:11px}.a7-compact .a6-dashboard .p8-geo-wrap .a4-geo small{display:block;margin:2px 0 0}
 .a7-compact .a6-dashboard .a4-channel-card .a4-channel-list{overflow:hidden;gap:2px}.a7-compact .a6-dashboard .a4-channel{flex:1 0 26px;overflow:hidden;min-height:26px}
 .a7-compact .a7-analytics .page-head h1{font-size:22px}.a7-compact .a7-analytics .page-head .actions{gap:4px}.a7-compact .a7-analytics .page-head button{font-size:11px;padding:7px 8px}
}
@media(min-width:1180px) and (min-height:680px) and (max-height:800px){
 .a7-compact .a6-dashboard .p6-topline,.a7-compact .a6-dashboard .p6-meta{display:none!important}.a7-compact .a6-dashboard .p6-name{font-size:13px!important;height:18px;line-height:18px!important}.a7-compact .a6-dashboard .p6-stats{gap:4px}.a7-compact .a6-dashboard .p6-stats dd{font-size:14px}.a7-compact .a6-dashboard .p6-stats dt{font-size:10.5px}
}
/* Messenger. The peer information panel is always first; other blocks are personal settings. */
.chat-list .list .p8-dialog{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;text-align:left;gap:11px;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:15px 6px;min-height:78px;overflow:hidden}
.p8-dialog .p8-dialog-avatar{width:43px;height:43px;min-width:43px;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;background:var(--soft);color:var(--accent)}
.p8-dialog-avatar img,.p8-contact-avatar img,.p8-head-avatar img{width:100%;height:100%;object-fit:cover}.p8-dialog-copy{min-width:0;flex:1;overflow:hidden}.p8-dialog-copy b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;line-height:1.4}.p8-dialog-copy small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.5;margin-top:4px}
.p8-dialog-meta{display:flex;flex-direction:column;align-items:flex-end;gap:8px;align-self:stretch;padding:1px 0;font-size:11px;color:var(--muted);min-width:36px}.p8-unread{font-size:11px;line-height:18px;min-width:18px;text-align:center;padding:0 4px;color:#fff;background:var(--accent);border-radius:10px}
.p8-chat-head>div:first-of-type{display:grid;grid-template-columns:39px minmax(0,1fr);gap:2px 9px;align-items:center;min-width:0}.p8-chat-head>div:first-of-type>strong{grid-column:2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p8-chat-head>div:first-of-type>small{grid-column:2;font-size:11px}.p8-head-avatar{grid-column:1;grid-row:1/3;width:39px;height:39px;border-radius:50%;overflow:hidden}
.p8-side-controls{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.p8-side-controls button{width:31px;height:31px;padding:5px}.p8-side-person{text-align:center;border-bottom:1px solid var(--line);padding:2px 0 16px}.p8-contact-avatar{width:62px;height:62px;border-radius:50%;margin:12px auto;overflow:hidden}.p8-side-person h3{font-size:16px;margin:8px 0;overflow-wrap:anywhere}.p8-side-person p{font-size:13px;line-height:1.4;margin:4px 0}.p8-side-person .eyebrow{font-size:10px;letter-spacing:1px}
.p8-side-widget{padding:16px 0;border-bottom:1px solid var(--line);min-width:0}.p8-side-widget h3{font-size:14px;margin-bottom:10px}.p8-side-widget p{font-size:12px;line-height:1.45;margin:5px 0;white-space:pre-wrap;overflow-wrap:anywhere}.p8-side-widget>button,.p8-side-file{display:flex;width:100%;gap:8px;align-items:center;justify-content:flex-start;font-size:12px;text-align:left;margin:6px 0;text-decoration:none}.p8-side-file span{min-width:0;overflow-wrap:anywhere}.p8-side-item{padding:5px 0}.p8-side-item b{font-size:12px}.p8-side-member{display:flex;align-items:center;gap:8px;font-size:12px;padding:6px 0}.p8-side-member .avatar{width:29px;height:29px;border-radius:50%;overflow:hidden}
.p8-widget-choice{display:flex;align-items:center;gap:7px;padding:8px 0;border-bottom:1px solid var(--line)}.p8-widget-choice label{display:flex;align-items:center;gap:8px;flex:1;margin:0}.p8-widget-choice input{width:18px;height:18px}.p8-widget-choice button{height:34px;width:34px;padding:4px}#p8-widgets-save{margin-top:18px}
@media(min-width:1251px){.chat-layout{grid-template-columns:minmax(220px,.85fr) minmax(320px,1.75fr) minmax(235px,.9fr)!important;gap:14px;max-width:1420px}.chat-side{display:block!important;overflow-y:auto!important;min-height:0;min-width:0;padding:18px}.chat-main,.chat-list{min-width:0!important}.chat-head #message-search{width:140px}}
@media(max-width:900px){
 .crm-chat-page .chat-list{padding:8px 14px!important;background:var(--surface)}.crm-chat-page .chat-list .list{gap:0}.crm-chat-page .chat-list .list .p8-dialog{min-height:82px;border-radius:0;padding:13px 1px}.crm-chat-page .p8-dialog-copy b{font-size:16px}.crm-chat-page .p8-dialog-copy small{font-size:13px}.crm-chat-page .p8-dialog .p8-dialog-avatar{width:49px;height:49px;min-width:49px}.crm-chat-page .chat-list input{background:var(--bg);border:0;min-height:43px;border-radius:12px}
 .crm-chat-page .messages{background:var(--bg);padding:14px 12px!important;gap:9px}.crm-chat-page .message{max-width:90%;margin-bottom:8px}.crm-chat-page .message.mine{margin-left:auto}.crm-chat-page .bubble{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 12px;line-height:1.45;font-size:15px;overflow-wrap:anywhere}.crm-chat-page .message.mine .bubble{background:var(--soft);border-color:transparent}.crm-chat-page .message .msg-tools{display:none}.crm-chat-page .message.show-tools .msg-tools{display:flex;flex-wrap:wrap}.crm-chat-page .message>small{font-size:12px}.crm-chat-page .message>div.row small{font-size:10px}
 .crm-chat-page .chat-head{padding:9px 10px;gap:8px;min-height:65px}.crm-chat-page .chat-head #message-search{display:none}.crm-chat-page .chat-head .p8-head-avatar{width:36px;height:36px}.crm-chat-page .chat-head>div:first-of-type{flex:1;min-width:0}.crm-chat-page .chat-head>div.row{flex:0 0 auto}.crm-chat-page .chat-head>div:first-of-type>strong{font-size:15px}
 .crm-chat-page .compose{padding:9px 12px!important;background:var(--surface)}.crm-chat-page .compose textarea{min-height:40px!important;max-height:130px!important;font-size:16px;line-height:1.4;background:var(--bg);border-radius:16px!important;padding:9px 12px!important}.crm-chat-page .compose .tools{margin-top:4px}.crm-chat-page .compose .tools button{width:37px;height:37px;min-height:37px;border:0;border-radius:50%;padding:7px}
 .p8-team-group>summary{display:block}.p8-team-group>summary span{display:block}.p8-team-table{overflow-x:auto}.p8-team-row{min-width:650px}.p8-admin-person{display:block}.p8-admin-person .actions{margin-top:9px}.p8-admin-unit{padding-left:9px}.p8-admin-unit summary small{display:none}
 .p8-side-modal .p8-side-person{max-width:100%}.a4-products .a4-product-image{width:42px!important;height:48px!important}.a4-products .a4-product{align-items:center!important}.p8-rating{font-size:13px;min-height:36px}
}
@media(prefers-reduced-motion:reduce){.p8-dialog,.p8-rating{transition:none}}

#p8-chat-search{display:none}
@media(min-width:1180px){body:not(.a7-compact) .a6-dashboard>.trend-panel{grid-column:1/5;grid-row:1}body:not(.a7-compact) .a6-dashboard>.a4-channel-card{grid-column:5/9;grid-row:1}body:not(.a7-compact) .a6-dashboard>.p6-spotlight{grid-column:9/13;grid-row:1}body:not(.a7-compact) .a6-dashboard>.p6-geography{grid-column:1/5;grid-row:2}body:not(.a7-compact) .a6-dashboard>.a4-products{grid-column:5/9;grid-row:2}body:not(.a7-compact) .a6-dashboard>.brand-panel{grid-column:9/13;grid-row:2}body:not(.a7-compact) .a6-dashboard>.a4-channel-card .a4-channel-list{grid-template-columns:1fr}}
@media(max-width:900px){#p8-chat-search{display:inline-flex}.crm-chat-page .chat-head.p8-search-open{position:relative;padding-bottom:57px}.crm-chat-page .p8-search-open #message-search{display:block;position:absolute;left:12px;right:12px;bottom:8px;width:calc(100% - 24px);font-size:16px;min-height:38px}}
