/* Mobile-first layout corrections shared by customer and admin panels. */
:root{--bt-panel-shell-max:var(--bt-shell-content-max,1236px);--bt-panel-shell-gutter:var(--bt-shell-gutter,22px)}
.app{width:calc(100% - (var(--bt-panel-shell-gutter) * 2));max-width:var(--bt-panel-shell-max);margin-inline:auto}
.sidebar{left:max(var(--bt-panel-shell-gutter),calc((100vw - var(--bt-shell-max,1280px))/2 + var(--bt-panel-shell-gutter)))!important}
.main{width:calc(100% - var(--sb));max-width:calc(100% - var(--sb))}
body.bt-admin-shared-header>.app{min-height:calc(100vh - 72px)}
body.bt-admin-shared-header>.app>.sidebar{top:72px}
body.bt-admin-shared-header>.app>.main>.bt-legacy-profile-topbar{display:none!important}
.panel-sidebar-backdrop{position:fixed;inset:0;z-index:89;border:0;padding:0;cursor:pointer;background:rgba(7,10,16,.58);backdrop-filter:blur(3px);opacity:0;visibility:hidden;transition:opacity .2s ease,visibility .2s ease}
body.panel-menu-open{overflow:hidden}
body.panel-menu-open .panel-sidebar-backdrop{opacity:1;visibility:visible}
.sidebar{overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.main,.content,.page,.view{min-width:0;max-width:100%}
.topbar{box-sizing:border-box}.topbar>*{min-width:0}.topbar .search{min-width:180px}.topbar .search input{min-width:0;width:100%}
.btn,.icon-btn,.nav-item,.pg{touch-action:manipulation}.btn:disabled,.icon-btn:disabled,.pg:disabled{cursor:not-allowed;opacity:.58;box-shadow:none}
.tbl-wrap{overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
.card-head,.page-head,.page-actions,.filters{min-width:0}
@media(max-width:900px){
  .app{width:100%;max-width:100%;margin-inline:0}
  .sidebar{left:0!important;width:min(84vw,310px)!important;max-width:calc(100vw - 44px);z-index:90!important;box-shadow:24px 0 60px rgba(0,0,0,.28)}
  .sidebar.open{transform:translateX(0)!important}
  .main{width:100%;max-width:100%;min-width:0}
  .topbar{position:sticky;top:0;z-index:70;height:auto!important;min-height:66px;flex-wrap:wrap;padding:10px 14px!important;gap:8px!important}
  .topbar .burger{flex:0 0 40px;width:40px!important;height:40px!important;border:1px solid var(--border);border-radius:12px;background:var(--surface-2)}
  .topbar .search{order:20;flex:1 0 100%;max-width:none!important;width:100%}
  .topbar .search input{height:44px}
  .topbar .spacer{margin-left:auto}
  .topbar .user-chip{padding:3px}.topbar .user-chip .u-meta{display:none}.topbar .user-chip .avatar{width:38px;height:38px}
  .page{padding:20px!important}.page-head{gap:12px;margin-bottom:18px}.page-actions{width:100%;margin-left:0!important}
  .filters{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}.filters>.field{min-width:0}
  .card-head{flex-wrap:wrap;padding:15px 16px}.card-head .right{max-width:100%;flex-wrap:wrap}.card-body{padding:16px}
  .tabs{margin-inline:-4px;padding:2px 4px 6px;scroll-snap-type:x proximity}.tabs button{scroll-snap-align:start;min-height:42px}
  .tbl-wrap{margin-inline:-1px;border-radius:0 0 var(--radius) var(--radius)}
  .list-item{min-width:0}.list-item>div{min-width:0}
  .chat-list{display:block!important;max-height:220px;overflow:auto;border-bottom:1px solid var(--border)}
}
@media(max-width:760px){body.bt-admin-shared-header>.app{min-height:calc(100vh - 116px)}body.bt-admin-shared-header>.app>.sidebar{top:116px}}
@media(max-width:640px){
  .page{padding:14px!important}.page-head h1{font-size:20px!important;line-height:1.25}.page-head p{font-size:12.5px!important}
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}.g3,.g2,.g-2-1,.g-1-2{grid-template-columns:1fr!important}
  .kpi{padding:15px!important}.kpi-top{margin-bottom:9px}.kpi-val{font-size:23px!important}.kpi-foot{font-size:10.5px}
  .filters{grid-template-columns:1fr!important}.filters>.btn,.filters>.field{width:100%}
  .page-actions>*{flex:1 1 150px;justify-content:center;min-width:0}.page-actions select{width:100%!important}
  .card-head .right{width:100%;margin-left:0!important}.card-head .right>*{max-width:100%}
  .card-body{padding:14px!important}.btn{min-height:44px}.btn.sm{min-height:40px}
  .by-listing-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}.by-listing-actions .btn{width:100%;min-height:44px;justify-content:center;padding-inline:8px}
  .chat-list{max-height:210px}.composer{position:sticky;bottom:0;background:var(--surface);border-top:1px solid var(--border)}
  table{min-width:620px}th,td{padding:12px 13px!important}.pager{gap:9px;flex-wrap:wrap}.pager>.hint{flex:1 1 180px}
}
@media(max-width:390px){
  .topbar{padding:8px 10px!important}.page{padding:11px!important}.g4{gap:8px!important}
  .kpi{padding:13px!important}.kpi-label{font-size:11px}.kpi-val{font-size:21px!important}
  .card{border-radius:14px!important}.card-head{padding:13px}.card-body{padding:12px!important}
  .tabs button{padding-inline:13px}.page-actions>*{flex-basis:100%}
}

/* Keep help controls clear of the mobile message composer. */
@media(max-width:900px){body:has(#v-chat.on) .bt-assistant{bottom:calc(92px + env(safe-area-inset-bottom,0px))!important}}

/* Reserve the full send label; the input takes remaining mobile width. */
@media(max-width:640px){#chat-composer>.input{flex:1 1 0%;width:0;min-width:0}#chat-composer>.btn{flex:0 0 auto;padding-inline:10px;font-size:12px;white-space:nowrap}}
