/* Shared layout rules loaded after module styles. */
.wa-shell,.wa-main-canvas,.wa-content-area,.wa-chat,.wa-chat-active,.wa-sidebar{min-width:0;min-height:0}
.wa-shell{height:var(--wa-viewport-height,100dvh);max-width:100%;isolation:isolate}
.wa-main-canvas{height:100%;overflow-x:hidden}
.wa-content-area{overflow-x:hidden}
.wa-sidebar-resizer[hidden]{display:none!important}
body:not([data-sidebar-view="tools"]):not([data-sidebar-view="away_message"]):not([data-sidebar-view="lists"]):not([data-sidebar-view="list_detail"]) #wa-sidebar-resizer{display:none!important}
body:is([data-sidebar-view="chats"],[data-sidebar-view="archived"]) #wa-sidebar{width:clamp(320px,34vw,420px)!important;min-width:320px!important;max-width:420px!important;opacity:1;pointer-events:auto}
.wa-mobile-tools-bar,.wa-mobile-overview{display:none}
.wa-chat-active{flex:1;overflow:hidden}
.wa-chat-active img,.wa-chat-active video{max-width:100%;height:auto}
.wa-chat-header .chat-header-info{min-width:0}
.chat-header-title,.chat-header-subtitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wa-composer{flex-shrink:0;padding-bottom:max(8px,env(safe-area-inset-bottom))}
.composer-input{min-width:0}
.table-responsive,.mtm-table-responsive{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.wa-main-canvas .row>*{min-width:0}
body #wa-insights-canvas .mi-shell,#ti-page .ti-shell{min-width:0;width:100%}
body #wa-insights-canvas :is(.mi-card,.mi-panel,.mi-chip),#ti-page :is(.ti-stat,.ti-money-card,.ti-panel){min-width:0;overflow-wrap:anywhere}
body #wa-insights-canvas .mi-bar-label{gap:12px}
body #wa-insights-canvas .mi-bar-label strong{white-space:nowrap}
#ti-page .ti-layout{grid-template-columns:minmax(260px,350px) minmax(0,1fr)}
#ti-page .ti-money,#ti-page .ti-performance-cards{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.mtm-header,.mtm-toolbar-filters,.wa-topbar{gap:12px;flex-wrap:wrap}
.mtm-body{min-width:0}
.mtm-builder-layout>*{min-width:0}
.wa-main-canvas :is(.stat-card,.wa-card){min-width:0;overflow-wrap:anywhere}
@media(min-width:993px){
 .wa-sidebar-resizer{height:100%}
 #back-to-chats{display:none!important}
}
@media(min-width:993px) and (max-width:1300px){
 body #wa-insights-canvas .mi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body #wa-insights-canvas .mi-grid>.mi-panel:last-child{grid-column:1/-1}
 body #wa-insights-canvas .mi-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
 #ti-page .ti-layout{grid-template-columns:280px minmax(0,1fr)}
}
@media(max-width:992px){
 .wa-shell{height:var(--wa-viewport-height,100dvh)!important}
 #wa-sidebar-resizer,#tools-collapse-sidebar-btn{display:none!important}
 body:is([data-sidebar-view="chats"],[data-sidebar-view="archived"]) #wa-sidebar{width:100%!important;min-width:0!important;max-width:100%!important}
 .wa-main-canvas{order:1;flex:1 1 0!important;width:100%!important;height:auto!important;min-height:0;max-width:100%}
 body[data-sidebar-view="tools"] #wa-sidebar{display:none!important}
 body[data-sidebar-view="tools"][data-mobile-tools-menu="open"] #wa-sidebar{display:flex!important}
 body[data-sidebar-view="tools"][data-mobile-tools-menu="open"] #wa-insights-canvas{display:none!important}
 body:is([data-sidebar-view="away_message"],[data-sidebar-view="lists"],[data-sidebar-view="list_detail"]) #wa-insights-canvas{display:none!important}
 body:is([data-sidebar-view="away_message"],[data-sidebar-view="lists"],[data-sidebar-view="list_detail"]) #wa-sidebar{display:flex!important}
 .wa-mobile-tools-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-bottom:1px solid var(--wa-dark-border,#2a3942);flex-shrink:0}
 .wa-mobile-tools-bar button,.wa-mobile-overview{border:1px solid var(--wa-dark-border,#2a3942);background:var(--wa-dark-rail,#202c33);color:inherit;border-radius:8px;padding:8px 12px;min-height:40px}
 .wa-mobile-overview{display:inline-flex}
 html[data-bs-theme="light"] :is(.wa-mobile-tools-bar button,.wa-mobile-overview){background:#fff;border-color:#e9edef}
 #back-to-chats,#empty-back-to-chats{display:inline-flex!important;flex-shrink:0}
 .wa-app-rail{height:calc(62px + env(safe-area-inset-bottom))!important;min-height:calc(62px + env(safe-area-inset-bottom))!important;padding-bottom:calc(4px + env(safe-area-inset-bottom))!important}
 .wa-app-rail .rail-btn{min-height:44px!important;height:50px!important}
 .wa-topbar{padding:12px 16px!important;min-height:56px}
 .wa-content-area{padding:16px!important;flex:1;overflow-y:auto;overscroll-behavior-y:contain}
 body #wa-insights-canvas .mi-shell{padding:18px}
 body #wa-insights-canvas .mi-grid{grid-template-columns:1fr}
 body #wa-insights-canvas .mi-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
 body #wa-insights-canvas :is(.mi-header,.mi-toolbar,.mi-panel-head){flex-wrap:wrap;gap:14px}
 body #wa-insights-canvas .mi-dates{flex-wrap:wrap;gap:8px}
 body #wa-insights-canvas .mi-actions{flex-wrap:wrap}
 body #wa-insights-canvas .mi-health{flex-wrap:wrap}
 body #wa-insights-canvas .mi-chip{max-width:100%}
 #ti-page{height:var(--wa-viewport-height,100dvh);bottom:auto;overscroll-behavior-y:contain}
 #ti-page .ti-layout{grid-template-columns:1fr}
 #ti-page .ti-layout>div:first-child{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #ti-page .ti-layout>div:first-child>aside{grid-column:1/-1}
 #ti-page .ti-layout>div:first-child .ti-panel{margin-bottom:0}
 #ti-page .ti-heading{gap:16px}
 #ti-page .ti-controls{width:100%;flex-wrap:wrap}
 .mtm-overlay{height:var(--wa-viewport-height,100dvh);max-width:100vw;overflow-y:auto;overscroll-behavior-y:contain}
 .mtm-header{padding:14px 16px}
 .mtm-body{padding:16px;overflow-x:hidden}
 .mtm-toolbar-filters{display:flex;flex-wrap:wrap;gap:10px}
 .mtm-toolbar-filters>*{max-width:100%;min-width:0}
 .mtm-builder-layout{grid-template-columns:1fr!important;gap:16px}
 .mtm-preview-sticky-card{position:static;max-width:400px;width:100%}
 .wizard-steps{overflow-x:auto;max-width:100%;gap:12px;padding-bottom:8px}
 .wizard-step-item{flex-shrink:0;min-width:80px}
 .modal-dialog{max-width:calc(100vw - 24px);margin:12px auto}
 .modal-content{max-height:calc(var(--wa-viewport-height,100dvh) - 24px)}
 .modal-body{overflow-y:auto;min-height:0}
 .modal-footer{flex-wrap:wrap}
}
@media(max-width:600px){
 .wa-sidebar-header{padding:12px 14px}
 .wa-search-wrap,.wa-filter-row{padding-left:12px;padding-right:12px}
 .wa-filter-row{overflow-x:auto;flex-wrap:nowrap;max-width:100%}
 .wa-filter-row>*{flex-shrink:0}
 .wa-chat-header{padding:8px!important;gap:4px}
 #chat-header-standard{min-width:0}
 #chat-header-avatar{width:36px;height:36px;min-width:36px;margin-right:8px!important}
 .wa-chat-header .wa-icon-btn{width:36px;min-width:36px}
 .wa-composer{padding-left:8px;padding-right:8px;gap:6px}
 .wa-composer .wa-icon-btn,.composer-tool-btn{min-width:36px;width:36px;height:40px}
 .message-bubble,.message-in,.message-out{max-width:88%}
 .message-bubble{overflow-wrap:anywhere}
 .wa-main-canvas :is(.d-flex.gap-2,.d-flex.gap-3){flex-wrap:wrap}
 .wa-main-canvas .wa-topbar>div{flex-wrap:wrap;gap:8px!important}
 .wa-main-canvas input:not([type=checkbox]):not([type=radio]):not([type=hidden]),.wa-main-canvas select,.mtm-input,.mtm-textarea{max-width:100%;font-size:16px!important;min-width:0}
 .wa-main-canvas :is(input[type=date],select){min-height:42px}
 .wa-main-canvas .stat-card{padding:14px;height:100%}
 .wa-main-canvas .stat-value{font-size:26px}
 .wa-main-canvas .btn{white-space:normal;min-height:40px}
 body #wa-insights-canvas .mi-shell{padding:14px}
 body #wa-insights-canvas h1{font-size:26px}
 body #wa-insights-canvas .mi-card{padding:14px}
 body #wa-insights-canvas .mi-value{font-size:28px}
 body #wa-insights-canvas .mi-panel{padding:16px}
 body #wa-insights-canvas .mi-presets{display:flex;flex-wrap:wrap}
 body #wa-insights-canvas .mi-dates{display:grid;grid-template-columns:auto minmax(0,1fr);width:100%}
 body #wa-insights-canvas input[type=date]{width:100%;max-width:none}
 body #wa-insights-canvas .mi-dates button{grid-column:1/-1}
 #ti-page .ti-shell{padding:14px}
 #ti-page h1{font-size:21px}
 #ti-page .ti-layout>div:first-child{display:block}
 #ti-page .ti-layout>div:first-child .ti-panel{margin-bottom:14px}
 #ti-page .ti-money,#ti-page .ti-performance-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
 #ti-page .ti-money-card,#ti-page .ti-stat{padding:14px}
 #ti-page .ti-stat strong{font-size:27px}
 #ti-page .ti-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 #ti-page .ti-controls label{flex-direction:column;align-items:flex-start;min-width:0}
 #ti-page .ti-controls input{width:100%;max-width:100%;font-size:16px}
 #ti-page #ti-refresh{grid-column:1/-1}
 #ti-page .ti-chart{margin:0 10px 14px;padding:4px}
 #ti-page .ti-breadcrumb{font-size:15px;gap:8px}
 .mtm-header{align-items:flex-start}
 .mtm-header h1{font-size:20px}
 .mtm-header button{min-height:40px}
 .mtm-toolbar-filters>*{flex:1 1 140px}
 #mtm-templates-table,#mtm-templates-table tbody{display:block;width:100%;min-width:0}
 #mtm-templates-table thead{display:none}
 #mtm-templates-table tbody{display:grid;gap:12px}
 #mtm-templates-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));position:relative;border:1px solid var(--mtm-border,#2a3942);border-radius:12px;overflow:hidden;background:var(--mtm-card,#111b21);padding:10px}
 #mtm-templates-table td{display:block;border:0!important;white-space:normal;min-width:0;padding:8px!important;overflow-wrap:anywhere}
 #mtm-templates-table td::before{content:attr(data-label);display:block;font-size:11px;color:var(--mtm-text-secondary,#8696a0);margin-bottom:3px}
 #mtm-templates-table td:nth-child(2){grid-column:1/-1;padding-left:38px!important;padding-right:42px!important;font-weight:600;min-height:48px}
 #mtm-templates-table td:first-child{position:absolute;left:8px;top:12px}
 #mtm-templates-table td:nth-child(4){position:absolute;right:8px;top:10px}
 #mtm-templates-table td:nth-child(4)::before,#mtm-templates-table td:first-child::before,#mtm-templates-table td:nth-child(2)::before{display:none}
 .mtm-card{padding:16px;min-width:0}
 .mtm-phone-container,.phone-preview{max-width:100%}
}
@media(prefers-reduced-motion:reduce){.wa-shell *{scroll-behavior:auto!important}}
@media(max-width:600px){.mtm-cat-tabs{grid-template-columns:1fr}.mtm-cat-tab{min-width:0;white-space:normal;padding:10px}.mtm-subtype-label-wrap{min-width:0}.mtm-summary-banner{flex-wrap:wrap}.mtm-summary-title{overflow-wrap:anywhere}.mtm-stepper{max-width:100%;overflow-x:auto}.mtm-form-row{grid-template-columns:1fr}.mtm-phone-container{width:100%;max-width:340px}}
/* Meta's four separate messaging breakdowns. */
body #wa-insights-canvas #insights-breakdowns{grid-template-columns:repeat(4,minmax(0,1fr))}
body #wa-insights-canvas #insights-breakdowns>.mi-panel:last-child{grid-column:auto}
body #wa-insights-canvas #insights-breakdowns .mi-panel-head{flex-wrap:wrap;gap:10px}
body #wa-insights-canvas #insights-breakdowns h2{font-size:16px}
@media(max-width:1599px){body #wa-insights-canvas #insights-breakdowns{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){body #wa-insights-canvas #insights-breakdowns{grid-template-columns:1fr}}
