/* Shared phone layout. Keep form controls at 16px to avoid input-focus zoom. */
@media(max-width:760px){
 html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
 body{min-width:0;touch-action:manipulation}
 input:not([type="checkbox"]):not([type="radio"]),select,textarea{font-size:16px!important;min-width:0;min-inline-size:0;max-width:100%;box-sizing:border-box}
 input[type="date"],input[type="time"],input[type="datetime-local"]{display:block;width:100%;max-inline-size:100%}
 input::-webkit-date-and-time-value{text-align:left;min-width:0}
 button,a,summary{touch-action:manipulation}
 button,.button,.reply{max-width:100%;white-space:normal;overflow-wrap:anywhere}
 main,section,article,form,fieldset,details,.panel,.wrap,.field,label{min-width:0}
 img,video,iframe{max-width:100%}
 p,h1,h2,h3,dd,.muted,.note{overflow-wrap:anywhere}
 /* Public pages: contain the header, forms and footer at narrow widths. */
 body:not([data-portal]) .wrap{padding-left:18px;padding-right:18px;width:100%;max-width:100%}
 body:not([data-portal]) .header-inner{column-gap:12px;row-gap:10px}
 body:not([data-portal]) .header-inner>a:first-child{flex:1 1 0;min-width:0;max-width:210px}
 body:not([data-portal]) .header-inner .logo{width:100%;height:auto}
 body:not([data-portal]) .header-inner .menu{flex:0 0 auto;min-width:84px;padding:10px 12px;box-shadow:none}
 body:not([data-portal]) .header-inner .nav{flex:1 0 100%;min-width:0}
 body:not([data-portal]) .contact-strip .wrap>a{min-width:0;padding:8px 10px}
 body:not([data-portal]) .hero-copy{padding:30px 18px}
 body:not([data-portal]) .hero-title-line{white-space:normal}
 body:not([data-portal]) .hero .actions{width:100%;gap:10px}
 body:not([data-portal]) .hero .actions .button{flex:1 1 150px;white-space:normal;text-align:center}
 body:not([data-portal]) .hero-features{gap:10px}
 body:not([data-portal]) .hero-features>span{min-width:0}
 body:not([data-portal]) .hero-features>span>span{font-size:.8125rem}
 body:not([data-portal]) .two-col,body:not([data-portal]) .contact-layout{grid-template-columns:minmax(0,1fr);gap:20px}
 body:not([data-portal]) .panel{padding:22px 18px}
 body:not([data-portal]) .body-copy.panel{width:calc(100% - 36px)}
 body:not([data-portal]) .home-planning .form-grid{grid-template-columns:minmax(0,1fr)}
 body:not([data-portal]) .form-grid,.product-list,.cards,.services-overview{min-width:0}
 body:not([data-portal]) .product,.photo-card,.category-caption,.service-description>div{min-width:0}
 body:not([data-portal]) .product .button{width:100%;text-align:center}
 body:not([data-portal]) .footer-contact-row{min-width:0;max-width:100%;overflow-wrap:anywhere}
 body:not([data-portal]) .footer-links{gap:8px 18px}
 body:not([data-portal]) .footer-links a{min-height:44px;display:inline-flex;align-items:center}
 body:not([data-portal]) .section-head{gap:12px;flex-wrap:wrap}
 body:not([data-portal]) .accreditation-group{gap:10px;padding:0 10px}
 body:not([data-portal]) .accreditation-group img{max-width:26%;height:48px;object-fit:contain}
 /* Office and driver workspaces. */
 body[data-portal] main{width:100%;max-width:100%;margin-left:0;padding:18px 16px 36px}
 body[data-portal] #workspace,body[data-portal] #operations-view,body[data-portal] #ops-content,body[data-portal] #maint-results{min-width:0;width:100%}
 body[data-portal] .login{width:100%;max-width:460px;padding:22px 18px;margin:24px auto}
 body[data-portal] .staff-workspace{min-width:0}
 body[data-portal] header{padding-left:16px;padding-right:16px}
 .staff-workspace .section-tabs,.driver-workspace .section-tabs{position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;overflow:visible;width:100%;padding:5px}
 .staff-workspace .section-tabs button,.driver-workspace .section-tabs button{width:100%;min-width:0;white-space:normal;padding:10px 8px;font-size:.8125rem;min-height:44px;margin:0!important}
 body[data-portal] .ops-heading>div,body[data-portal] .heading>div{min-width:0}
 body[data-portal] .edit-grid,body[data-portal] .facts{grid-template-columns:minmax(0,1fr)}
 body[data-portal] .ops-split,body[data-portal] .desk,body[data-portal] #customers-view .desk{grid-template-columns:minmax(0,1fr)}
 body[data-portal] .detail-top,body[data-portal] .save-row,body[data-portal] .pagination{flex-wrap:wrap}
 body[data-portal] .ops-actions>button,body[data-portal] .heading-actions>button,body[data-portal] .diary-actions>button{flex:1 1 120px;min-width:0}
 body[data-portal] .ops-toolbar>label{min-width:0;flex:1 1 100%}
 body[data-portal] .planner-filters{grid-template-columns:minmax(0,1fr)}
 body[data-portal] .planner-filters label{grid-column:1/-1!important}
 body[data-portal] .planner-navigation{gap:6px;min-width:0}
 body[data-portal] .planner-views{width:100%;display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
 body[data-portal] .planner-views button{padding:10px 4px;min-width:0}
 body[data-portal] .ops-modal,body[data-portal] .email-preview{width:calc(100% - 24px);max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);padding:18px 14px;overflow:auto;overscroll-behavior:contain}
 body[data-portal] .ops-modal fieldset{padding:14px 12px;min-width:0}
 body[data-portal] .ops-dialog-top{gap:12px;align-items:flex-start}
 body[data-portal] .ops-dialog-top h2{min-width:0;font-size:1.125rem}
 body[data-portal] .ops-signature{max-width:100%;touch-action:none}
 body[data-portal] .email-design-preview iframe{height:60dvh;max-height:560px}
 body[data-portal] .edit-form>.sticky-save{position:static}
 body[data-portal] .directory-vehicle{flex-wrap:wrap}
 body[data-portal] .directory-vehicle .directory-identity{flex:1 1 160px}
 body[data-portal] .directory-vehicle .ops-actions{width:100%;padding-left:0}
 body[data-portal] .customer-activity{flex:0 1 90px;max-width:90px;overflow-wrap:anywhere}
 body[data-portal] .maint-toolbar .ops-view-toggle{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%}
 body[data-portal] .maint-toolbar .maint-search,body[data-portal] .maint-toolbar>label{width:100%;max-width:none;min-width:0;flex:1 1 100%}
 body[data-portal] .maint-kind-tabs{flex-wrap:wrap;overflow:visible}
 body[data-portal] .maint-kind-tabs button{flex:1 1 100px;white-space:normal;font-size:.75rem}
 /* List views become labelled records rather than wide tables. */
 .maint-stack-table,.planner-table{display:block;width:100%;min-width:0;table-layout:auto}
 .maint-stack-table thead,.planner-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
 .maint-stack-table tbody,.planner-table tbody{display:block;width:100%}
 .maint-stack-table tr,.planner-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px;padding:16px;border-bottom:1px solid #e1e4e7}
 .maint-stack-table td,.planner-table td{display:block;padding:0;border:0;min-width:0;white-space:normal;overflow-wrap:anywhere;font-size:.875rem}
 .maint-stack-table td:first-child,.planner-table td:first-child{grid-column:1/-1}
 .maint-stack-table td:last-child,.planner-table td:last-child{grid-column:1/-1}
 .maint-stack-table td[data-label]:not([data-label=""])::before{content:attr(data-label);display:block;margin-bottom:6px;color:#59636d;font-size:.75rem;font-weight:600;white-space:normal}
 .maint-stack-table .maint-comment{min-width:0;white-space:pre-wrap;grid-column:1/-1}
 .maint-stack-table td:last-child button,.planner-table td:last-child button{width:100%}
 .planner-table td:nth-child(2)::before{content:'Material / delivery';display:block;font-size:.75rem;color:#59636d;margin-bottom:6px}
 .planner-table td:nth-child(3)::before{content:'Next outstanding load';display:block;font-size:.75rem;color:#59636d;margin-bottom:6px}
 .planner-table td:nth-child(4)::before{content:'Progress';display:block;font-size:.75rem;color:#59636d;margin-bottom:6px}
 /* Month views use full-width dated entries on phones. */
 .maint-calendar-scroll{margin:0;padding:0;overflow:visible}
 .maint-calendar-weekdays,.planner-month .planner-weekdays{display:none}
 .maint-calendar-grid,.planner-month .planner-days{display:grid;grid-template-columns:minmax(0,1fr);min-width:0;border:0;gap:14px}
 .maint-calendar-day,.planner-month .planner-day-cell{min-height:0;padding:0 0 14px;border:0;border-bottom:1px solid #e1e4e7;background:#fff}
 .maint-calendar-day.outside,.maint-calendar-day:not(:has(.maint-calendar-event)),.planner-month .planner-day-cell.outside-month,.planner-month .planner-day-cell:not(:has(.planner-event)){display:none}
 .maint-calendar-day>time{display:block;width:auto;height:auto;padding:8px 0;margin:0 0 4px;font-size:.875rem;color:#424b55}
 .maint-calendar-day.is-today>time{background:#fff0e7;color:#963109;border-radius:4px;padding-left:8px}
 .maint-calendar-event{padding:12px;margin-top:8px;gap:5px}.maint-calendar-event strong{font-size:.875rem}.maint-calendar-event span{font-size:.8125rem}
 .maint-calendar-grid:not(:has(.maint-calendar-day:not(.outside) .maint-calendar-event))::after{content:'No maintenance scheduled this month.';padding:20px 0;color:#59636d;font-size:.875rem}
 .planner-month .planner-days{padding:14px}
 .planner-month .planner-day-heading{justify-content:space-between;padding:0 0 8px}
 .planner-month .planner-day-heading button{width:auto;gap:6px;padding:8px;min-width:44px}
 .planner-month .planner-day-word{display:inline}.planner-month .planner-day-heading>span{display:block}
 .planner-month .planner-day-events{padding:0;gap:8px}
 .planner-month .planner-event{padding:12px}.planner-month .planner-event .planner-customer{display:block;font-size:.9375rem;overflow:visible}
 .planner-month .planner-event-top strong{font-size:.875rem}.planner-month .planner-event-top>span{display:inline}
 .planner-month .planner-more{font-size:.875rem;text-align:left;padding:10px}
 .planner-month .planner-days:not(:has(.planner-day-cell:not(.outside-month) .planner-event))::after{content:'No loads scheduled this month.';color:#59636d;padding:12px 0;font-size:.875rem}
}
@media(max-width:360px){
 body[data-portal] main{padding-left:12px;padding-right:12px}
 body[data-portal] .maint-vehicle-dates,body[data-portal] .maint-documents dl{grid-template-columns:minmax(0,1fr)}
 .maint-stack-table tr,.planner-table tr{grid-template-columns:minmax(0,1fr)}
}

/* Size Safari date controls against the service section's inner track. */
@media(max-width:760px){
 body[data-portal] .ops-modal .ops-split{width:100%;min-width:0;grid-template-columns:minmax(0,1fr)}
 body[data-portal] .ops-modal .maint-service-section{display:grid;grid-template-columns:minmax(0,1fr);width:100%;min-width:0;max-width:100%;box-sizing:border-box}
 body[data-portal] .ops-modal .maint-service-section>label{display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box}
 body[data-portal] .ops-modal .maint-service-section>label>input,
 body[data-portal] .ops-modal .maint-service-section>label>select{display:block;inline-size:100%;min-inline-size:0;max-inline-size:100%;box-sizing:border-box}
 /* A viewport cap also contains native iOS date inputs when WebKit ignores the grid track. */
 body[data-portal] .ops-modal fieldset label>input:not([type="checkbox"]),
 body[data-portal] .ops-modal fieldset label>select,
 body[data-portal] .ops-modal .maint-service-section>label>input,
 body[data-portal] .ops-modal .maint-service-section>label>select{
  width:calc(100% - 24px)!important;max-width:calc(100% - 24px)!important;box-sizing:border-box
 }
 body[data-portal] .ops-modal .ops-inline-check{display:inline-flex;width:auto;max-width:100%;justify-content:flex-start;gap:10px;align-items:center}
 body[data-portal] .ops-modal .ops-inline-check input[type="checkbox"]{display:inline-block;flex:0 0 20px;width:20px!important;min-width:20px;height:20px;margin:0}
}
@media(max-width:760px){
 .maint-calendar-day.outside:has(.maint-calendar-event),.maint-calendar-day.outside.has-brake-window{display:block}
 #maintenance-body .maint-service td:last-child button{white-space:nowrap;width:auto;min-width:64px}
}

@media(max-width:760px){
 .maint-calendar.week-view .maint-calendar-day:not(.outside){display:block;min-height:56px}
 .maint-calendar.week-view .maint-calendar-grid:not(:has(.maint-calendar-event)):not(:has(.maint-window-event))::after{content:none}
}
