/* Shared layout safeguards. Scroll wide data locally, never clip the whole page. */
.layout-container,.layout-page,.content-wrapper,main,.card,.card-body{min-width:0}
.table-responsive,.gps-report-table-wrap{max-width:100%;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.gps-page-header>div,.gps-page-header p,.modal-body,.swal2-html-container{min-width:0;overflow-wrap:anywhere}
.gps-adaptive-table td{overflow-wrap:anywhere}
.gps-table-scroll:focus-visible{outline:3px solid #2563eb;outline-offset:2px}
@media(max-width:1100px){
 .gps-map-focus.gps-job-focus .map-stage{height:auto;min-height:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding-top:480px;gap:12px;padding-bottom:12px}
 .gps-map-focus.gps-job-focus #dashboardMap{height:480px}
 .gps-map-focus.gps-job-focus .map-fleet-panel,.gps-map-focus.gps-job-focus .map-detail-panel{position:relative;top:auto;bottom:auto;left:auto;right:auto;width:auto;margin:0 12px;max-height:none}
 .gps-map-focus.gps-job-focus .map-fleet-panel{order:1}.gps-map-focus.gps-job-focus .map-detail-panel{order:2}
 .gps-map-focus.gps-job-focus .map-fleet-list{max-height:440px;flex:auto}
 .gps-map-focus.gps-job-focus .map-floating-tools{left:12px;right:12px;max-width:none;top:12px}
 .gps-map-focus.gps-job-focus .map-legend{position:relative;left:auto;right:auto;bottom:auto;margin:0 12px;grid-column:1/-1;order:0}
 .gps-map-focus.gps-job-focus .leaflet-top.leaflet-left{left:0;top:118px}
 .gps-map-focus.gps-job-focus .map-summary{grid-template-columns:minmax(0,1fr)}
 .gps-map-focus.gps-job-focus .map-summary-date{grid-column:auto}
}
@media(max-width:767.98px){
 .container-p-y{padding-top:18px!important;padding-bottom:24px!important}
 .gps-page-header{flex-wrap:wrap;gap:12px}.gps-page-header h2{font-size:1.35rem;line-height:1.5}
 .gps-page-header>.btn{width:100%;white-space:normal}
 .btn,.btn-sm,.nav-link{min-height:44px;white-space:normal}
 .form-control,.form-select,.swal2-input,.swal2-select{font-size:16px!important;max-width:100%;min-height:44px}
 input[type=file]{width:100%;min-width:0}
 .input-group{min-width:0}.input-group .form-control{min-width:0}
 .modal-dialog{margin:12px!important;max-width:calc(100% - 24px)!important}
 .modal-content{max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px)}
 .modal-body{overflow-y:auto;overscroll-behavior:contain}.modal-header,.modal-footer{flex-shrink:0}
 .modal-footer{gap:8px;flex-wrap:wrap}.modal-footer>.btn{flex:1 1 120px;margin:0}
 .swal2-popup{max-width:calc(100vw - 24px)!important;padding:16px!important}
 .swal2-html-container{margin:12px 0!important}.swal2-title{font-size:1.35rem!important}
 .swal2-actions{gap:8px;flex-wrap:wrap}.swal2-actions button{min-height:44px}
 .dataTables_wrapper .row{row-gap:12px}.dataTables_filter input{max-width:60vw!important}
 .pagination{flex-wrap:wrap;gap:4px}
 .merge-form{flex-wrap:wrap}.merge-form .form-select{flex:1 1 130px}
 .gps-adaptive-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .gps-adaptive-table,.gps-adaptive-table tbody,.gps-adaptive-table tr,.gps-adaptive-table td{display:block;width:100%;min-width:0}
 .gps-adaptive-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px;padding:12px 16px;border-bottom:6px solid #f1f5f9}
 .gps-adaptive-table td:last-child,.gps-adaptive-table td[colspan],.gps-adaptive-table td[data-label="บริษัท"],.gps-adaptive-table td[data-label="ลูกค้า"]{grid-column:1/-1}
 .gps-segment-tabs{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;overflow:visible!important}
 .gps-segment-tabs>a{min-width:0;min-height:44px;white-space:normal;justify-content:center}
 .gps-adaptive-table td{padding:8px 0!important;border:0!important;text-align:left!important;max-width:none}
 .gps-adaptive-table td[data-label]:before{content:attr(data-label);display:block;color:#61758d;font-size:.75rem;font-weight:600;margin-bottom:4px}
 .gps-adaptive-table .badge{white-space:normal}
 .gps-map-focus.gps-job-focus .map-stage{grid-template-columns:minmax(0,1fr);padding-top:440px}
 .gps-map-focus.gps-job-focus #dashboardMap{height:440px}
 .gps-map-focus.gps-job-focus .map-fleet-list{max-height:330px}
 #map{height:60vh!important;height:60dvh!important;min-height:300px!important;max-height:580px}
 .gps-report-results-head{flex-wrap:wrap}
 .gps-auth-panel{padding:24px 16px!important}.gps-login-card{max-width:100%}
}
@media(max-width:380px){.gps-map-focus.gps-job-focus .map-floating-tools{gap:5px}.gps-map-focus.gps-job-focus .map-floating-tools button,.gps-map-focus.gps-job-focus .map-floating-tools label{padding:8px;font-size:.7rem}.gps-map-focus.gps-job-focus .leaflet-top.leaflet-left{top:145px}}
@media(prefers-reduced-motion:reduce){.modal.fade .modal-dialog,.collapsing{transition:none!important}}
@media(max-height:500px) and (max-width:1100px){.modal-dialog{margin:8px auto!important}.modal-content{max-height:calc(100dvh - 16px)}.modal-body{overflow-y:auto}.gps-map-focus.gps-job-focus #dashboardMap{height:340px}.gps-map-focus.gps-job-focus .map-stage{padding-top:340px}}
