/* Nanaimo Movers 24.10.2 — Mobile browser / iPhone Safari usability pass */
html{width:100%;min-height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%;overflow-x:hidden}
body{width:100%;min-height:100%;overflow-x:hidden;-webkit-tap-highlight-color:transparent}
.appShell{min-height:100dvh}
.main,.page{min-width:0;max-width:100%}
img,video,canvas,iframe{max-width:100%}

@media(max-width:900px){
 html,body{min-height:100dvh}
 /* Body's horizontal clipping creates an auto vertical overflow boundary.
    Keep root overscroll control on html so a one-finger pan can reach it. */
 html{overscroll-behavior-y:none}
 body.nm-theme{min-height:100dvh}
 .appShell{width:100%;min-height:100dvh;overflow-x:hidden}
 body.nm-theme .sidebar{height:100dvh;max-height:100dvh;padding-top:max(14px,env(safe-area-inset-top));padding-bottom:max(14px,env(safe-area-inset-bottom));overflow-y:auto;-webkit-overflow-scrolling:touch}
 body.nm-theme .main{width:100%;max-width:100vw;min-height:100dvh;overflow-x:hidden}
 body.nm-theme .topbar{position:sticky;top:0;z-index:28;min-height:60px;padding:calc(8px + env(safe-area-inset-top)) 12px 8px;background:color-mix(in srgb,var(--bg,#f3f5fa) 92%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-bottom:1px solid color-mix(in srgb,var(--line,#e3e8f0) 80%,transparent)}
 body.nm-theme .page{width:100%;max-width:none;padding:12px 10px calc(104px + env(safe-area-inset-bottom));overflow-x:hidden}
 body.nm-theme .mobileNav{display:grid!important;grid-template-columns:repeat(6,minmax(58px,1fr))!important;justify-content:initial;gap:2px;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;padding:6px 6px max(7px,env(safe-area-inset-bottom));background:color-mix(in srgb,var(--panel,#fff) 95%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);box-shadow:0 -7px 25px rgba(17,39,67,.09)}
 body.nm-theme .mobileNav button{min-width:58px;min-height:50px;padding:4px 3px!important;font-size:18px!important;touch-action:manipulation}
 body.nm-theme .mobileNav button span{font-size:9px!important;line-height:1.1;white-space:nowrap}
 body.nm-theme .helpFab{right:12px;bottom:calc(82px + env(safe-area-inset-bottom));min-width:48px;min-height:48px}
 body.nm-theme button,body.nm-theme [role="button"],body.nm-theme summary{touch-action:manipulation}
 body.nm-theme .btn,body.nm-theme button:not(.calEvent):not(.jobBlock):not(.nmmsg-thread){min-height:44px}
 body.nm-theme input:not([type="checkbox"]):not([type="radio"]),body.nm-theme select,body.nm-theme textarea{font-size:16px!important;min-height:44px}
 body.nm-theme .topbar .hello{min-width:0}body.nm-theme .topbar .hello h1{font-size:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}body.nm-theme .topbar .hello p{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.nm-theme .profileChip{padding:4px;border-radius:11px}.profileChip>div:last-child{display:none}
 body.nm-theme .avatar{width:38px;height:38px}
 body.nm-theme .sectionTitle,body.nm-theme .commandTop,body.nm-theme .customerHeader,body.nm-theme .cardHead,body.nm-theme .calendarToolbar,body.nm-theme .jobCommandHero>div:first-child{min-width:0;flex-wrap:wrap;align-items:flex-start}
 body.nm-theme .sectionTitle>*,body.nm-theme .commandTop>*,body.nm-theme .cardHead>*{max-width:100%}
 body.nm-theme .layout,body.nm-theme .msgLayout,body.nm-theme .jobStart,body.nm-theme .invoiceDesigner,body.nm-theme .reconcile,body.nm-theme .receiptCapture{grid-template-columns:minmax(0,1fr)!important}
 body.nm-theme .formgrid,body.nm-theme .formgrid.three,body.nm-theme .formgrid.four,body.nm-theme .builderGrid,body.nm-theme .formRow{grid-template-columns:minmax(0,1fr)!important}
 body.nm-theme .commandMetrics,body.nm-theme .metrics,body.nm-theme .nm-metrics,body.nm-theme .commandGrid,body.nm-theme .fleetStatus{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 body.nm-theme .fleetGrid,body.nm-theme .inventoryGrid,body.nm-theme .storageGrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 body.nm-theme .card,body.nm-theme .nm-panel,body.nm-theme .opsHero,body.nm-theme .jobCommandHero{max-width:100%;overflow:hidden}
 body.nm-theme .cardBody{max-width:100%;overflow-wrap:anywhere}
 body.nm-theme .tableWrap,body.nm-theme .dispatchBoard,body.nm-theme .monthGrid,body.nm-theme .weekGrid,body.nm-theme .jobTabs,body.nm-theme .flow,body.nm-theme .cashForecast{max-width:100%;overflow-x:auto!important;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none}
 body.nm-theme .tableWrap::-webkit-scrollbar,body.nm-theme .dispatchBoard::-webkit-scrollbar,body.nm-theme .monthGrid::-webkit-scrollbar,body.nm-theme .weekGrid::-webkit-scrollbar,body.nm-theme .jobTabs::-webkit-scrollbar{display:none}
 body.nm-theme .modal,body.nm-theme .drawer{max-width:100vw}
 body.nm-theme .modalCard,body.nm-theme .modal-card{max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px);overflow:auto;-webkit-overflow-scrolling:touch}
 body.nm-theme .toast{max-width:calc(100vw - 24px)}
 body.nm-theme .globalSearch:focus-within{right:58px!important;left:10px!important;top:calc(8px + env(safe-area-inset-top))!important}
 body.nm-theme #globalSearchResults{max-width:calc(100vw - 20px)!important;min-width:0!important;width:calc(100vw - 20px)!important;left:10px!important;right:auto!important}
}

@media(max-width:560px){
 body.nm-theme .page{padding-inline:9px}
 body.nm-theme .commandMetrics,body.nm-theme .metrics,body.nm-theme .nm-metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px}
 body.nm-theme .commandGrid,body.nm-theme .fleetStatus,body.nm-theme .fleetGrid,body.nm-theme .inventoryGrid,body.nm-theme .storageGrid{grid-template-columns:minmax(0,1fr)!important}
 body.nm-theme .quickActions,body.nm-theme .contactGrid,body.nm-theme .mobileJobAction{grid-template-columns:minmax(0,1fr)!important}
 body.nm-theme .cardHead{padding:12px 13px 7px}.nm-theme .cardBody{padding:8px 13px 14px}
 body.nm-theme .sectionTitle h2,body.nm-theme .commandTop h2,body.nm-theme .jobCommandHero h2{font-size:21px!important}
 body.nm-theme .nm-hero{border-radius:14px;padding:21px 17px;min-height:0}.nm-theme .nm-hero h1{font-size:25px;max-width:100%}.nm-theme .nm-hero p{max-width:100%;font-size:12px}
 body.nm-theme .listRow{display:grid;grid-template-columns:minmax(0,1fr);gap:7px;align-items:start}.nm-theme .listRow>.btn,.nm-theme .listRow>.pill{justify-self:start}
 body.nm-theme .profitJob{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 body.nm-theme .mobileNav{grid-template-columns:repeat(6,62px)!important}
}

/* iPhone Safari: use dynamic viewport and safe-area padding instead of 100vh. */
@supports(-webkit-touch-callout:none){
 @media(max-width:900px){
  html,body,.appShell{min-height:-webkit-fill-available}
  body.nm-theme .topbar{padding-top:max(10px,env(safe-area-inset-top))}
  body.nm-theme .mobileNav{padding-bottom:max(8px,env(safe-area-inset-bottom))}
  body.nm-theme input,body.nm-theme textarea,body.nm-theme select{-webkit-appearance:none;border-radius:10px}
  body.nm-theme select{-webkit-appearance:auto}
  body.nm-theme .tableWrap,body.nm-theme .dispatchBoard,body.nm-theme .monthGrid,body.nm-theme .weekGrid{transform:translateZ(0)}
 }
}

/* Nanaimo Movers: bottom navigation follows the selected day/night theme.
 * Append to the latest v24-10-2-mobile.css before the next release.
 * Keep this outside a width query: the existing shell controls visibility.
 */
:root[data-nm-theme] body.nm-theme .mobileNav {
  background: var(--nm248-surface, var(--card, #fff)) !important;
  color: var(--nm248-text, var(--text, #18263c)) !important;
  border-top-color: var(--nm248-line, var(--line, #e3e8f0)) !important;
}
:root[data-nm-theme] body.nm-theme .mobileNav button {
  background: transparent !important;
  color: var(--nm248-muted, var(--muted, #63738a)) !important;
}
:root[data-nm-theme] body.nm-theme .mobileNav button.active {
  background: var(--nm248-surface2, var(--bg, #f3f5fa)) !important;
  color: var(--nm248-blue, var(--blue, #2e5ce6)) !important;
}

/* 24.10.8 — keep the bottom navigation phone-only and size the desktop composer panel. */
@media (min-width: 801px) {
  body.nm-theme .mobileNav { display: none !important; }
}
@media (min-width: 851px) {
  body.nm-theme .nmmsg-shell,
  body.nm-theme .nmmsg-shell.details-on {
    height: calc(100dvh - 176px);
    min-height: min(620px, calc(100dvh - 176px));
  }
}


/* 24.10.9 — constrain the desktop Messenger grid so the composer stays in view. */
@media (min-width: 851px) {
  body.nm-theme .nmmsg-shell,
  body.nm-theme .nmmsg-shell.details-on {
    grid-template-rows: minmax(0, 1fr) !important;
  }
  body.nm-theme .nmmsg-main,
  body.nm-theme .nmmsg-conversation-host {
    min-height: 0;
    overflow: hidden;
  }
  body.nm-theme .nmmsg-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  body.nm-theme .nmmsg-composer {
    flex: 0 0 auto;
    align-self: stretch;
  }
}