/* Loaded only on screens <=700px. Desktop and printed documents retain their rules. */
:root{--mobile-viewport-height:100vh}
html,body{width:100%;max-width:100%;overflow-x:visible}
body{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
.mobile-only{display:inline-flex!important}
.topbar{position:relative;display:flex!important;align-items:center!important;justify-content:space-between;gap:8px!important;padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px!important}
.topbar .brand-home{flex:1;min-width:0;margin:0!important}
.topbar .eyebrow{font-size:9px}
.topbar h1{font-size:17px;line-height:1.2;overflow-wrap:anywhere}
#mobileMenuBtn{flex:none;align-items:center;justify-content:center;min-height:44px}
.topbar .header-right{display:none;width:100%;flex-basis:100%;min-width:0}
.topbar.mobile-menu-open .header-right{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;max-height:calc(var(--mobile-viewport-height) - 80px);overflow-y:auto;overscroll-behavior:contain}
.topbar .header-main-nav{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;width:100%;overflow:visible;padding:0}
.topbar .header-main-nav .btn{min-width:0;min-height:44px;white-space:normal;overflow-wrap:anywhere;font-size:14px}
.topbar .header-main-nav .btn[style*="display: none"],.topbar .header-actions [style*="display: none"]{display:none!important}
.header-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}
.header-actions>.btn,.header-menu>.btn{width:100%;min-height:44px;justify-content:center}
.header-user-trigger,.header-user-trigger .userpill{max-width:none;text-align:left;width:auto;white-space:normal;overflow-wrap:anywhere}
.topbar .header-dropdown{position:static;min-width:0;width:100%;margin-top:5px;box-shadow:none}
.header-dropdown button{min-height:44px}
.toolbar{padding:10px 12px 6px;gap:6px;min-width:0}
.toolbar .nav{display:grid;grid-template-columns:44px 1fr 44px;gap:6px;width:100%;min-width:0}
.toolbar .nav .btn{min-height:44px;padding:8px}
#periodTitle{grid-column:1/-1;text-align:center;font-size:15px;overflow-wrap:anywhere}
#mobileFilterBtn{min-height:44px;width:100%;align-items:center;justify-content:center;font-size:13px}
#calendarPage:not(.calendar-filters-open) #calendarSearch,#calendarPage:not(.calendar-filters-open) #calendarViews{display:none}
.toolbar .search{display:flex;align-items:center;gap:6px;width:100%;min-width:0;padding:6px 10px}
.toolbar .search input{width:100%;min-width:0;min-height:36px;font-size:16px}
#calendarViews{padding:4px 12px 10px;gap:6px;min-width:0}
#calendarViews>.btn{flex:1;min-height:44px;padding:8px 5px}
.custom-range{width:100%;min-width:0}
.custom-range input{width:100%;min-width:0;flex:1 1 120px}
#calendar{margin:4px 8px 0;min-width:0;overflow:visible}
.mobile-dayblock{padding:8px;border-bottom:1px solid var(--ui-line-d1d5db)}
.mobile-daytitle{margin:0 0 6px;font-size:15px;line-height:1.4;text-transform:capitalize}
.mobile-emplist{gap:4px}
.mobile-emp{padding:6px 8px;border-radius:8px;min-width:0;margin-top:4px}
.mobile-emp-empty{padding:0 8px;background:var(--ui-surface-fafafa)}
.mobile-emphead{display:grid;grid-template-columns:minmax(0,1fr) auto 44px;gap:5px;align-items:center;margin:0;min-height:44px}
.mobile-empname{font-size:13px;overflow-wrap:anywhere}
.mobile-emphead .capacity{margin:0;font-size:10px;white-space:normal;max-width:95px;text-align:center}
.mobile-day-action{width:44px;height:44px;padding:4px;font-size:22px!important}
.mobile-booking-button{display:grid;width:100%;text-align:left;color:inherit;font:inherit;min-width:0;border:0;border-left:3px solid var(--ui-line-2563eb);cursor:pointer;padding:8px;gap:2px;overflow-wrap:anywhere}
.mobile-booking-button .customer{font-size:13px}
.mobile-booking-button .note,.mobile-booking-button .memo-note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.mobile-month{min-width:0;padding:8px}
.mobile-month-grid,.mobile-month-weekdays{grid-template-columns:repeat(7,minmax(0,1fr))}
.mobile-month-cell{min-width:0;min-height:44px;padding:4px;font-size:13px}
.mobile-month-detail{padding:8px 0}
.mobile-month-detail h3{font-size:16px}
.mobile-month-add{width:100%;min-height:44px}
#calendarPage>.hint{font-size:12px;margin:10px 12px}
.app-page,.jobs-layout,.jobs-sidebar,.jobs-content,.page-head,.page-actions,.job-editor-shell,.job-editor-body{min-width:0;max-width:100%}
.app-page{padding:12px}
.page-head h2{font-size:22px}
.page-actions{width:100%}
.overview-summary,.invoice-totals,.invoice-edit-grid,.job-kpi-grid{grid-template-columns:minmax(0,1fr)}
.overview-card strong{font-size:20px;overflow-wrap:anywhere}
.mobile-filter-group{min-width:0;margin:8px 0;border:1px solid var(--ui-line-d1d5db);border-radius:10px;background:var(--ui-surface-ffffff)}
.mobile-filter-group>summary{min-height:44px;padding:12px;font-size:14px;font-weight:650;cursor:pointer;overflow-wrap:anywhere}
.mobile-filter-group .overview-filters,.mobile-filter-group .jobs-filters,.mobile-filter-group .invoice-period{display:grid!important;grid-template-columns:minmax(0,1fr)!important;min-width:0;margin:0!important;padding:8px;gap:8px}
.mobile-filter-group input,.mobile-filter-group select{width:100%;min-width:0!important;max-width:100%}
.overview-table-wrap,.admin-list-table-wrap{max-width:100%;min-width:0;overflow-x:auto;-webkit-overflow-scrolling:touch}
.jobs-stage-tabs,.tabs,.invoice-subtabs{max-width:100%;flex-wrap:wrap}
.jobs-stage-tab{min-width:0;white-space:normal}
input,select,textarea{min-width:0;max-width:100%;font-size:16px!important}
input:not([type=checkbox]):not([type=radio]),select{min-height:44px}
.btn{min-height:44px;touch-action:manipulation;white-space:normal}
button:focus-visible,summary:focus-visible,[role=button]:focus-visible{outline:3px solid var(--ui-line-2563eb);outline-offset:2px}
.modalbg{align-items:flex-start;top:var(--mobile-viewport-top,0px);bottom:auto;height:var(--mobile-viewport-height);padding:8px 8px max(8px,env(safe-area-inset-bottom,0px));overflow:hidden}
.modalbg .modal{min-width:0;width:100%;max-width:100%;max-height:100%;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:14px}
.modal .modal-actions{bottom:-14px;gap:6px;padding-bottom:max(10px,env(safe-area-inset-bottom,0px))}
.modal-actions .btn{flex:1 1 110px}
.modal .two,.invoice-item-form,.invoice-item-editor,.invoice-edit-grid{grid-template-columns:minmax(0,1fr)!important}
.modal label,.modal fieldset,.invoice-line,.invoice-line-top{min-width:0;overflow-wrap:anywhere}
.modal fieldset{padding:8px;margin:0}
.invoice-item-form input,.invoice-item-form select{width:100%}

.mobile-empty-employees>summary{padding:12px 4px;min-height:44px;font-size:13px;color:var(--ui-ink-475569);cursor:pointer}

#calendarPage>.hint:not(.mobile-only){display:none}
#calendarPage>.mobile-calendar-hint{display:block!important}
input[type=date],input[type=time]{width:100%;min-inline-size:0}
input::-webkit-date-and-time-value{min-height:1.3em;text-align:left}

/* The job editor has its own fixed shell, not the shared .modalbg wrapper. */
.jobs-list-primary #jobEditorShell{
  top:calc(var(--mobile-viewport-top,0px) + env(safe-area-inset-top,0px) + 8px);
  left:calc(env(safe-area-inset-left,0px) + 8px);right:calc(env(safe-area-inset-right,0px) + 8px);bottom:auto;
  transform:none;width:auto;max-width:none;
  height:calc(var(--mobile-viewport-height,100vh) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 16px);
  max-height:calc(var(--mobile-viewport-height,100vh) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 16px);
  overflow:hidden;border-radius:14px;
}
#jobEditorShell[style*="display: block"]{display:flex!important;flex-direction:column}
.jobs-list-primary #jobEditorShell::before{inset:0}
#jobEditorShell>.job-editor-head{flex:0 0 auto;min-width:0;padding:12px;gap:8px}
#jobEditorShell .job-editor-head>div{min-width:0;overflow-wrap:anywhere}
#jobEditorShell .job-editor-head h3{font-size:20px;line-height:1.25}
#jobEditorShell .job-editor-number{flex:none;max-width:35%;overflow-wrap:anywhere}
#jobEditorShell>.job-editor-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:12px;scroll-padding-block:12px;background:var(--ui-surface-f8fafc)}
#jobEditorShell>.job-editor-actions{position:static;flex:0 0 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:10px 12px;background:var(--ui-surface-ffffff)}
#jobEditorShell>.job-editor-actions>.spacer{display:none}
#jobEditorShell>.job-editor-actions>.btn{min-width:0;min-height:44px;padding:8px;overflow-wrap:anywhere}
#jobEditorShell .job-form{grid-template-columns:minmax(0,1fr)}
#jobEditorShell .job-form label{display:flex;flex-direction:column;gap:6px;min-width:0;line-height:1.4}
#jobEditorShell .job-form input,#jobEditorShell .job-form select,#jobEditorShell .job-form textarea{display:block;width:100%;margin:0;min-width:0}
#jobEditorShell .job-form label:has(#jCustomer)>.entity-search{width:100%!important;max-width:100%!important}
#jobEditorShell .job-form label:has(#jCustomer)>.entity-search::placeholder{font-size:16px;color:var(--ui-ink-64748b)}
#jobEditorShell .task-add{flex-wrap:wrap}
#jobEditorShell .task-add input{min-width:0;width:100%;flex:1 1 160px}
body:has(#jobEditorShell[style*="display: block"]){overflow:hidden}

@media(max-width:700px){
  #calendarViews #viewMonth,#calendarViews #viewCustom,#calendarViews #customRange{display:none!important}
  .mobile-emphead{grid-template-columns:minmax(0,1fr) auto auto}
  .mobile-day-action.register-time{width:auto;height:auto;min-height:44px;padding:8px 10px;font-size:13px!important;white-space:nowrap}
  .mobile-booking-button .mobile-time-cta{display:inline-block;margin-top:5px;color:var(--ui-ink-1d4ed8);font-size:12px;font-weight:650}
}
