/* Mobile layout: keep content in flow; wide calendars retain their own scroll areas. */
:root{--erp-safe-top:env(safe-area-inset-top,0px);--erp-safe-right:env(safe-area-inset-right,0px);--erp-safe-bottom:env(safe-area-inset-bottom,0px);--erp-safe-left:env(safe-area-inset-left,0px)}
/* Each notification action gets its own grid row, including on desktop. */
.wf-notice{grid-template-columns:minmax(0,1fr) auto}
.wf-notice button{grid-row:auto;max-width:100%;white-space:normal}
@media(max-width:1000px){
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  .workspace,#main,.c-head>*,.w-task>*,.page-heading>*,.form-grid>*,.c-properties>*,.c-file>*{min-width:0}
  #main{overflow-wrap:anywhere}
  .page-heading,.w-task,.c-file{flex-wrap:wrap}
  .c-actions,.form-actions{max-width:100%}
  button,.primary,.secondary{max-width:100%;white-space:normal;overflow-wrap:anywhere}
  input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px;max-width:100%}
  input[type=date],input[type=datetime-local],input[type=time]{min-width:0;width:100%;appearance:none;-webkit-appearance:none}
  .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .modal-head,.help-heading,.erp-settings-heading{gap:12px;align-items:flex-start}
  .modal-head h2,.help-heading h2,.erp-settings-heading h2{min-width:0;overflow-wrap:anywhere}
  .modal-head button,.help-heading button,.erp-settings-heading button{flex-shrink:0}
  dialog{max-height:calc(100dvh - 24px - var(--erp-safe-top) - var(--erp-safe-bottom));overflow-y:auto;overscroll-behavior:contain}
  .toast{max-width:calc(100vw - 32px - var(--erp-safe-left) - var(--erp-safe-right));right:calc(16px + var(--erp-safe-right));bottom:calc(16px + var(--erp-safe-bottom));overflow-wrap:anywhere}
  .sf-conversation{min-height:min(280px,40dvh);max-height:58dvh}
  .mc-contact-panel{padding-bottom:var(--erp-safe-bottom);padding-right:var(--erp-safe-right);max-width:calc(100vw - var(--erp-safe-left))}
  .mc-group-dialog{max-height:calc(100dvh - 32px - var(--erp-safe-top) - var(--erp-safe-bottom))}
}
@media(max-width:760px){
  .login{min-height:100dvh;padding:calc(16px + var(--erp-safe-top)) calc(16px + var(--erp-safe-right)) calc(16px + var(--erp-safe-bottom)) calc(16px + var(--erp-safe-left))}
  .login-card{width:min(390px,100%);padding:24px}
  .workspace>header{height:auto;min-height:65px;padding:calc(10px + var(--erp-safe-top)) calc(16px + var(--erp-safe-right)) 10px calc(16px + var(--erp-safe-left));align-items:center}
  .header-right{flex:1;justify-content:flex-end;min-width:0}
  .account{min-width:0;max-width:100%}
  .account .avatar{flex-shrink:0}
  #menu{flex:0 0 44px}
  #menu,#erp-help-button,#erp-settings-button,.modal-head>.icon-button,.help-heading>.icon-button{width:44px;min-height:44px;flex-basis:44px}
  #sidebar{max-width:calc(100vw - 48px);padding-top:calc(25px + var(--erp-safe-top));padding-bottom:calc(20px + var(--erp-safe-bottom));padding-left:calc(14px + var(--erp-safe-left));overscroll-behavior:contain}
  #main{padding-left:calc(16px + var(--erp-safe-left));padding-right:calc(16px + var(--erp-safe-right))}
  footer{padding-left:calc(16px + var(--erp-safe-left));padding-right:calc(16px + var(--erp-safe-right));padding-bottom:calc(20px + var(--erp-safe-bottom))}
  .form-grid{grid-template-columns:minmax(0,1fr)}
  .wf-notice{grid-template-columns:minmax(0,1fr)}
  .wf-notice button{grid-column:1;grid-row:auto;justify-self:start}
  .w-grid h2{flex-wrap:wrap}
  .c-task button[data-c-select]{min-width:0;overflow-wrap:anywhere}
  .c-tree details>summary{flex-wrap:wrap}
  .c-task summary{padding-bottom:12px!important}
  .c-clock{position:static;flex-basis:100%;white-space:normal;text-align:right}
  .c-branch{margin-left:6px}
  .sf-file{flex-wrap:wrap}
  #erp-help{height:calc(100dvh - 16px - var(--erp-safe-top) - var(--erp-safe-bottom));max-height:calc(100dvh - 16px - var(--erp-safe-top) - var(--erp-safe-bottom))}
  #help-index{max-height:24dvh}
  #erp-settings{max-height:calc(100dvh - 24px - var(--erp-safe-top) - var(--erp-safe-bottom))}
}
@media(max-height:500px) and (max-width:1000px){
  .login{place-items:start center}
  #erp-help{height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}
  #erp-help[open]{overflow:auto}
  #help-content,.help-layout,#help-topic{flex:none;overflow:visible}
  #help-index{max-height:120px;overflow:auto}
}
@media(max-width:760px){
  /* The full employee name stays in the button's accessible text and settings. */
  .account>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

/* Messenger: list and conversation are separate mobile screens. */
.mc-back{display:none}
@media(max-width:800px){.mc-back{display:inline-flex;min-height:44px;align-items:center;margin-bottom:12px}.mc-layout[data-pane=list]>.mc-thread,.mc-layout[data-pane=thread]>.mc-contacts{display:none}.mc-contacts{max-height:none}.mc-thread{min-width:0}.mc-thread h2{overflow-wrap:anywhere}#mc-messages{min-height:min(180px,30dvh);max-height:48dvh}.mc-contact-panel{inset:0 0 0 auto;height:100dvh;padding-top:calc(16px + env(safe-area-inset-top));padding-bottom:calc(16px + env(safe-area-inset-bottom))}.mc-group-dialog input[type=checkbox]{width:20px;flex:0 0 20px}.mc-group-dialog fieldset label{min-width:0;overflow-wrap:anywhere}}

/* Keep valid long task titles inside the detail panel on desktop. */
.c-detail h2{overflow-wrap:anywhere}
