/* Screen-only mobile layout. Keep report/PDF rendering and desktop untouched. */
@media screen and (max-width:900px){
 .layout{grid-template-columns:minmax(0,1fr)!important;display:block!important}
 .main,#main,#modal-content{min-width:0;max-width:100%;box-sizing:border-box}
 .main{padding:18px 12px!important;padding-bottom:80px!important}
 .sidebar{position:relative!important;height:auto!important;width:100%;padding:16px!important}
 .sidebar nav{display:flex!important;overflow-x:auto;gap:8px;max-width:100%}
 .sidebar nav .nav-item{flex:0 0 auto}.sidebar nav a{white-space:nowrap}
 .sidebar .brand{padding:0 0 12px}.sidebar .account{margin-top:14px}
 #main .panel,#main .cards,#main .dashboard-overview,#main .dashboard-report-grid,#main .report-card,dialog section{min-width:0;max-width:100%;box-sizing:border-box}
 #main .page-head{flex-wrap:wrap;align-items:flex-start;gap:14px;padding-left:16px!important;padding-right:16px!important}
 #main h1{font-size:23px;overflow-wrap:anywhere}
 #main .toolbar,#main .actions,dialog .actions{flex-wrap:wrap;max-width:100%}
 #main .toolbar>*,dialog .grid>*{min-width:0;max-width:100%}
 #main .toolbar label,#main .toolbar input:not([type=checkbox]),#main .toolbar select{width:100%;max-width:none!important}
 #main .grid,dialog .grid,#main .dashboard-overview,#main .dashboard-report-grid{grid-template-columns:minmax(0,1fr)!important}
 #main .record-info{grid-template-columns:minmax(0,1fr)!important}
 #main .table-wrap,dialog .table-wrap{display:block;width:100%;max-width:100%;min-width:0;overflow:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;touch-action:pan-x pan-y}
 #main .table-wrap table,dialog .table-wrap table{table-layout:auto!important;width:100%!important;min-width:440px!important}
 #main .table-wrap table:has(th:nth-child(5)),dialog .table-wrap table:has(th:nth-child(5)){min-width:850px!important}
 #main .table-wrap table:has(th:nth-child(8)),dialog .table-wrap table:has(th:nth-child(8)){min-width:1300px!important}
 #main .table-wrap table:has(th:nth-child(11)),dialog .table-wrap table:has(th:nth-child(11)){min-width:1650px!important}
 #main .table-wrap :is(th,td),dialog .table-wrap :is(th,td){width:auto!important;min-width:100px!important;max-width:300px!important;padding:12px!important;font-size:13px!important;line-height:1.5!important;text-align:left;vertical-align:top;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important}
 #main .table-wrap th,dialog .table-wrap th{white-space:nowrap!important}
 #main .table-wrap .badge,dialog .table-wrap .badge{white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;display:inline-block;max-width:none!important}
 #main .table-wrap button,dialog .table-wrap button{min-width:40px!important;min-height:40px;white-space:nowrap!important;margin:3px}
 #main #partner-results :is(td,th):last-child{position:static!important;box-shadow:none}
 #main.frozen-list-filters>.toolbar,#main .quote-controls{position:static!important}
 dialog{width:96vw!important;max-width:96vw!important;max-height:92dvh;overflow:auto;padding:16px}
 dialog:has(.assign-work-dialog){padding:0}
 input,select,textarea{font-size:16px!important;max-width:100%;box-sizing:border-box}
 .form-actions{flex-wrap:wrap;gap:8px;padding-bottom:env(safe-area-inset-bottom)}
 .quote-frame,.quote-preview-frame{max-width:100%;min-width:0}
}
@media screen and (max-width:480px){#main .cards{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}.stat{padding:12px}.stat strong{font-size:24px}}
