/* OrbisERP V41 · Instant Native Motion
   Reliability first: no cross-document View Transitions. Those transitions can
   stall/skip inside installed PWAs while a navigation is waiting on network or
   the service worker. Navigation is immediate; motion only decorates the page
   after its HTML is already available. */
:root{
  --orbis-motion-fast:72ms;
  --orbis-motion-ui:118ms;
  --orbis-motion-page:155ms;
  --orbis-motion-ease:cubic-bezier(.2,.75,.25,1);
  --orbis-motion-spring:cubic-bezier(.16,1,.3,1);
}

/* Explicitly disable cross-document snapshots. They were the main source of
   "tap -> waits -> blank/stuck -> refresh" reports in standalone PWA mode. */
@view-transition{navigation:none}

@keyframes orbisPageInForward{
  from{opacity:.01;transform:translate3d(0,5px,0)}
  to{opacity:1;transform:translate3d(0,0,0)}
}
@keyframes orbisPageInBack{
  from{opacity:.01;transform:translate3d(-4px,0,0)}
  to{opacity:1;transform:translate3d(0,0,0)}
}
@keyframes orbisDialogIn{
  from{opacity:0;transform:translate3d(0,6px,0) scale(.985)}
  to{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@keyframes orbisPopoverIn{
  from{opacity:0;transform:translate3d(0,-3px,0) scale(.99)}
  to{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@keyframes orbisBackdropIn{from{opacity:0}to{opacity:1}}
@keyframes orbisToastIn{
  from{opacity:0;transform:translate3d(0,7px,0)}
  to{opacity:1;transform:translate3d(0,0,0)}
}
@keyframes orbisCartLineIn{
  from{opacity:.35;transform:translate3d(0,4px,0)}
  to{opacity:1;transform:translate3d(0,0,0)}
}

/* Never hide the current document while leaving. A tap must start the browser
   navigation immediately. The destination receives a tiny entrance motion only
   after DOMContentLoaded, so animation can never delay business logic. */
html.orbis-motion-v41.orbis-motion-boot body>main,
html.orbis-motion-v41.orbis-motion-boot body.pos-page>.pos-layout,
html.orbis-motion-v41.orbis-motion-boot body>.tablet-shell,
html.orbis-motion-v41.orbis-motion-boot body>.split-layout,
html.orbis-motion-v41.orbis-motion-boot body>.denied{
  opacity:1!important;
  transform:none!important;
}
html.orbis-motion-v41.orbis-motion-ready:not(.orbis-motion-entered) body>main,
html.orbis-motion-v41.orbis-motion-ready:not(.orbis-motion-entered) body.pos-page>.pos-layout,
html.orbis-motion-v41.orbis-motion-ready:not(.orbis-motion-entered) body>.tablet-shell,
html.orbis-motion-v41.orbis-motion-ready:not(.orbis-motion-entered) body>.split-layout,
html.orbis-motion-v41.orbis-motion-ready:not(.orbis-motion-entered) body>.denied{
  animation:orbisPageInForward var(--orbis-motion-page) var(--orbis-motion-spring) both!important;
}
html.orbis-motion-v41.orbis-nav-back.orbis-motion-ready:not(.orbis-motion-entered) body>main,
html.orbis-motion-v41.orbis-nav-back.orbis-motion-ready:not(.orbis-motion-entered) body.pos-page>.pos-layout{
  animation-name:orbisPageInBack!important;
}

/* Controls feel responsive but never "float" for hundreds of milliseconds. */
html.orbis-motion-v41 body :where(
  button,.btn,.workspace-btn,.primary-action,.secondary-action,.action-btn,
  [role="button"],summary,.nav-item,.cashier-app,.tablet-app,.hub-card,.retail-launch-card,
  .product-card,.odoo-product-card,.module-card,.client-record,.crm-client-item,.drive-folder,.drive-file
){
  transition-property:transform,background-color,border-color,box-shadow,color,opacity!important;
  transition-duration:var(--orbis-motion-ui)!important;
  transition-timing-function:var(--orbis-motion-ease)!important;
}
html.orbis-motion-v41 body :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea
){
  transition:border-color var(--orbis-motion-ui) ease,box-shadow var(--orbis-motion-ui) ease,background-color var(--orbis-motion-ui) ease,color var(--orbis-motion-ui) ease!important;
}
html.orbis-motion-v41 body :where(
  button,.btn,.workspace-btn,.primary-action,.secondary-action,.action-btn,[role="button"],summary
):not(:disabled):active{
  transform:translate3d(0,1px,0) scale(.988)!important;
  transition-duration:45ms!important;
}

@media (hover:hover) and (pointer:fine){
  html.orbis-motion-v41 body.orbis-app :where(
    .workspace-card,.module-card,.product-card,.odoo-product-card,.hub-card,.retail-launch-card,
    .crm-v3-card,.crm-client-item,.drive-folder,.drive-file,.client-record
  ):hover,
  html.orbis-motion-v41 body.cashier-home :where(.cashier-app):hover{
    transform:translate3d(0,-1px,0)!important;
  }
}

html.orbis-motion-v41 :where(dialog[open],[role="dialog"]:not([hidden])){
  animation:orbisDialogIn 155ms var(--orbis-motion-spring) both!important;
  transform-origin:50% 35%;
}
html.orbis-motion-v41 :where(
  .global-search-modal.open,.global-search-modal[aria-hidden="false"],
  .modal-backdrop:not([hidden]),.master-modal-backdrop:not([hidden]),
  .supplier-modal-backdrop:not([hidden]),.workspace-dialog-backdrop:not([hidden]),
  .orbis-feedback-backdrop:not([hidden]),.orbis-confirm-backdrop:not([hidden]),
  .pos-quick-client-modal:not([hidden]),.pos-price-modal:not([hidden])
){animation:orbisBackdropIn 90ms ease-out both!important}
html.orbis-motion-v41 :where(
  .global-search-modal.open .global-search-panel,
  .global-search-modal[aria-hidden="false"] .global-search-panel,
  .modal-backdrop:not([hidden]) > :where(.editor-modal,[role="dialog"],.modal),
  .master-modal-backdrop:not([hidden]) > :where(.master-modal,[role="dialog"]),
  .supplier-modal-backdrop:not([hidden]) > :where(.supplier-modal,[role="dialog"]),
  .orbis-feedback-backdrop:not([hidden])>.orbis-feedback-dialog,
  .orbis-confirm-backdrop:not([hidden])>.orbis-confirm-dialog,
  .pos-quick-client-modal:not([hidden])>.pos-quick-client-card,
  .pos-price-modal:not([hidden])>.pos-price-card
){animation:orbisDialogIn 155ms var(--orbis-motion-spring) both!important}
html.orbis-motion-v41 :where(
  .orbis-account-menu[open]>.orbis-account-dropdown,
  .filter-popover:not([hidden]),.filters-popover:not([hidden]),
  .drive-menu-popover:not([hidden]),.quick-panel:not([hidden]),[popover]:popover-open
){animation:orbisPopoverIn 110ms var(--orbis-motion-spring) both!important}
html.orbis-motion-v41 :where(.crm-toast.show,.toast.show,.toast:not([hidden]),.flash-message,.alert[role="alert"]){
  animation:orbisToastIn 150ms var(--orbis-motion-spring) both!important;
}

/* POS keeps the shortest timings. */
html.orbis-motion-v41 body.pos-page :where(
  button,.pos-pay-choice,.product-card,.item-remove-btn,.pos-cart-code-add,.pos-touch-key
){transition-duration:80ms!important}
html.orbis-motion-v41 body.pos-page .order-item.orbis-motion-cart-line{
  animation:orbisCartLineIn 125ms var(--orbis-motion-spring) both!important;
}

html.orbis-motion-v41 :where(a,button,input,select,textarea,summary,[role="button"]):focus-visible{
  transition:box-shadow 90ms ease,border-color 90ms ease,outline-color 90ms ease!important;
}

@media (hover:none) and (pointer:coarse){
  :root{--orbis-motion-ui:92ms;--orbis-motion-page:135ms}
  html.orbis-motion-v41 body :where(button,.btn,[role="button"],summary):not(:disabled):active{transform:scale(.985)!important}
}

@media (prefers-reduced-motion:reduce){
  html.orbis-motion-v41 *,html.orbis-motion-v41 *::before,html.orbis-motion-v41 *::after{
    animation-duration:1ms!important;
    animation-delay:0ms!important;
    transition-duration:1ms!important;
    transition-delay:0ms!important;
    scroll-behavior:auto!important;
  }
}

/* V64 standalone motion: native-feel response without a 150ms page entrance tax. */
@media (display-mode:standalone){
  :root{--orbis-motion-ui:60ms;--orbis-motion-page:78ms}
}
html.orbis-standalone{--orbis-motion-ui:60ms;--orbis-motion-page:78ms}
