/* All About Material 1.0.71 — dashboard responsiveness (brand, architect and team dashboards). Loaded last. */

/* 1. Flex / grid children may shrink instead of pushing into their neighbours */
.aam-app-mode .aam-panel :is(div,article,section,form,label,aside,header,footer,dl,li){min-width:0}
.aam-app-mode .aam-panel :is(strong,small,p,dd,td,a,span,em,b){overflow-wrap:anywhere}
.aam-app-mode .aam-panel :is(.aam-btn,button,.aam-pill,.aam-status,.aam-chip,summary) {overflow-wrap:normal}

/* 2. Tables: scroll sideways rather than squash or spill */
.aam-app-mode .aam-table-wrap{max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
.aam-app-mode .aam-table-wrap>table{min-width:640px}
@media (min-width:1281px){.aam-app-mode .aam-pl .aam-table-wrap{overflow:visible!important}}
.aam-app-mode .aam-pa-card{min-width:0;max-width:100%}
.aam-app-mode .aam-pricing-admin>*{min-width:0}
.aam-app-mode .aam-pa-card table{display:block;max-width:100%;overflow-x:auto}

/* 3. Phones: wide tables become stacked cards (labels added by JS) */
@media (max-width:700px){
  .aam-app-mode table.aam-rtable{display:block!important;min-width:0!important;width:100%!important;border:0!important}
  .aam-app-mode table.aam-rtable thead{display:none!important}
  .aam-app-mode table.aam-rtable tbody{display:grid!important;gap:12px}
  .aam-app-mode table.aam-rtable tr{display:grid!important;gap:6px;padding:14px!important;border:1px solid #e7e9ee!important;border-radius:14px!important;background:#fff!important}
  .aam-app-mode table.aam-rtable td{display:grid!important;grid-template-columns:minmax(84px,32%) minmax(0,1fr);align-items:start;gap:10px;padding:4px 0!important;border:0!important;text-align:left!important;width:auto!important;white-space:normal!important}
  .aam-app-mode table.aam-rtable td::before{content:attr(data-label);color:#667085;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;padding-top:2px}
  .aam-app-mode table.aam-rtable td[data-label=""]{grid-template-columns:minmax(0,1fr)}
  .aam-app-mode table.aam-rtable td[data-label=""]::before{display:none}
  .aam-app-mode table.aam-rtable td:first-child{grid-template-columns:minmax(0,1fr);padding-bottom:8px!important;border-bottom:1px solid #f0f1f4!important}
  .aam-app-mode table.aam-rtable td:first-child::before{display:none}
  .aam-app-mode .aam-table-wrap:has(table.aam-rtable){overflow:visible!important;border:0!important;background:transparent!important;box-shadow:none!important}
}

/* 4. Team dashboard — brand applications */
.aam-app-mode .aam-approval-list article{display:grid!important;grid-template-columns:44px minmax(0,1fr) minmax(220px,280px);align-items:start;gap:14px 18px!important}
.aam-app-mode .aam-approval-list article>.aam-avatar{grid-column:1}
.aam-app-mode .aam-approval-list article>.aam-approval-content{grid-column:2;flex:none}
.aam-app-mode .aam-approval-list article>form.aam-brand-approval-actions{grid-column:3;display:flex!important;flex-direction:column;align-items:stretch;gap:10px;width:auto!important;padding:0!important}
.aam-app-mode .aam-brand-approval-actions .aam-foaid-brand-check{width:100%;box-sizing:border-box;margin:0}
.aam-app-mode .aam-brand-approval-actions>div{display:flex;gap:8px}
.aam-app-mode .aam-brand-approval-actions>div .aam-btn{flex:1;justify-content:center}
.aam-app-mode .aam-brand-details summary{max-width:100%;white-space:normal}
.aam-app-mode .aam-brand-review-grid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))!important}
.aam-app-mode .aam-brand-review-grid .aam-brand-review-about{grid-column:1/-1}
@media (max-width:1100px){
  .aam-app-mode .aam-approval-list article{grid-template-columns:44px minmax(0,1fr)}
  .aam-app-mode .aam-approval-list article>form.aam-brand-approval-actions{grid-column:2;flex-direction:row;flex-wrap:wrap;align-items:center}
  .aam-app-mode .aam-brand-approval-actions .aam-foaid-brand-check{flex:1 1 260px;width:auto}
}
@media (max-width:560px){
  .aam-app-mode .aam-approval-list article{grid-template-columns:minmax(0,1fr);padding:16px!important}
  .aam-app-mode .aam-approval-list article>.aam-avatar{display:none}
  .aam-app-mode .aam-approval-list article>.aam-approval-content,.aam-app-mode .aam-approval-list article>form.aam-brand-approval-actions{grid-column:1}
  .aam-app-mode .aam-brand-approval-actions>div{width:100%}
}

/* 5. Generic two/three-column panels collapse earlier */
@media (max-width:1180px){
  .aam-app-mode .aam-pl-health{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .aam-app-mode .aam-pl-fields{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media (max-width:640px){
  .aam-app-mode .aam-pl-health,.aam-app-mode .aam-pl-fields{grid-template-columns:minmax(0,1fr)!important}
}

/* 6. Panel headers: title shrinks, badges/buttons keep their size and wrap underneath when needed */
.aam-app-mode .aam-panel-head{flex-wrap:wrap;gap:10px 14px}
.aam-app-mode .aam-panel-head>*:first-child{flex:1 1 240px}
.aam-app-mode .aam-panel-head>*:not(:first-child){flex:0 0 auto}
.aam-app-mode :is(.aam-count-badge,.aam-btn,.aam-pill,.aam-status,.aam-chip,.aam-tag){white-space:nowrap}
@media (max-width:700px){.aam-app-mode table.aam-rtable td>*{justify-self:start;max-width:100%}}

/* 7. Small popovers stay on screen on phones */
@media (max-width:700px){
  .aam-app-mode .aam-user-enquiries>div{position:static!important;width:auto!important;margin-top:8px;box-shadow:none!important}
  .aam-app-mode .aam-pl-more[open]>div{max-width:calc(100vw - 24px)}
}
.aam-app-mode .aam-panel label{flex-wrap:wrap}
.aam-app-mode .aam-panel :is(s,del){white-space:normal}
/* tables: never break words letter-by-letter — scroll instead */
.aam-app-mode .aam-panel table :is(td,th,strong,small,a,span,p){overflow-wrap:normal;word-break:normal}
.aam-app-mode .aam-panel table td{min-width:90px}
.aam-app-mode .aam-panel table td:has(> .aam-avatar),.aam-app-mode .aam-panel table td:first-child{min-width:120px}
@media (max-width:700px){.aam-app-mode table.aam-rtable td{min-width:0!important}.aam-app-mode table.aam-rtable :is(td,strong,small,a,span,p){overflow-wrap:anywhere}}
.aam-app-mode .aam-table-wrap .aam-user-enquiries>div{position:static!important;width:100%!important;max-width:100%;margin-top:8px;box-shadow:none!important}

/* 1.0.79 — small-screen spills found by the dashboard audit */
label:has(> input[name="confirmation"]){display:block!important}
label:has(> input[name="confirmation"]) > input{display:block;width:100%;margin-top:8px}
.aam-user-enquiries{min-width:0;max-width:100%}
.aam-user-enquiries > div{min-width:0;max-width:100%;width:auto!important}
.aam-user-enquiries > div a{display:block;min-width:0;max-width:100%;white-space:normal!important}
.aam-user-enquiries > div a strong,.aam-user-enquiries > div a small{display:block;white-space:normal!important;overflow-wrap:anywhere}
