/* MORTX shared shell: the widgets column spans the viewport from top to bottom.
   Header, filters, page content and footer stay inside the left workspace column. */
body.mortx-ui-shell .mortx-workspace{
  --mortx-widgets-width:300px;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) var(--mortx-widgets-width);
  align-items:stretch;
  min-width:0;
  min-height:100dvh;
}
body.mortx-ui-shell .mortx-workspace-main{
  display:flex;flex-direction:column;min-width:0;min-height:100dvh;
}
body.mortx-ui-shell .mortx-content-layout{
  display:block;flex:1 0 auto;min-width:0;min-height:0;
}
body.mortx-ui-shell .mortx-content-layout > .mortx-content{
  min-width:0;width:100%;max-width:100%;box-sizing:border-box;
}
body.mortx-ui-shell .mortx-widgets-panel{
  position:sticky;top:0;align-self:start;height:100dvh;min-height:0;
  min-width:0;display:flex;flex-direction:column;
  border-left:1px solid var(--ui-border,rgba(128,145,170,.18));
  background:var(--ui-surface,rgba(128,145,170,.035));color:inherit;
}
body.mortx-ui-shell .mortx-widgets-panel-head{height:var(--mortx-shell-header-height);min-height:var(--mortx-shell-header-height);flex:0 0 var(--mortx-shell-header-height);display:flex;align-items:center;padding:0 14px;border-bottom:1px solid var(--ui-border,rgba(128,145,170,.18));box-sizing:border-box}
/* Title is display-only; the header action icon is the sole toggle. */
body.mortx-ui-shell .mortx-widgets-panel-title{
  display:inline-flex;align-items:center;gap:10px;padding:0 8px;
  font-size:13px;font-weight:700;line-height:1;white-space:nowrap;
}
body.mortx-ui-shell .mortx-widgets-panel-label{white-space:nowrap;line-height:1}
body.mortx-ui-shell .mortx-widgets-panel-body{min-height:0;overflow:auto;flex:1;padding:0 14px 16px}
/* The fixed version footer must not extend underneath the widgets column. */
body.mortx-ui-shell .mortx-system-footer{right:var(--mortx-widgets-width)}
body.mortx-ui-shell:has(.mortx-workspace.widgets-collapsed) .mortx-system-footer{right:0}
/* Collapsed: return all panel width to workspace. Reopen via header icon. */
body.mortx-ui-shell .mortx-workspace.widgets-collapsed{--mortx-widgets-width:0px}
body.mortx-ui-shell .mortx-workspace.widgets-collapsed .mortx-widgets-panel{display:none}
body.mortx-ui-shell .mortx-workspace .mortx-widgets-panel[hidden]{display:none!important}
body.mortx-ui-shell .mortx-widgets-header-toggle[hidden]{display:none!important}
@media(max-width:1050px){body.mortx-ui-shell .mortx-workspace{--mortx-widgets-width:240px}}
@media(max-width:760px){
  body.mortx-ui-shell .mortx-workspace{--mortx-widgets-width:0px}
  body.mortx-ui-shell .mortx-widgets-panel{position:fixed;inset:0 0 0 auto;width:min(82vw,320px);height:100dvh;z-index:1400;display:flex;transform:translateX(102%);transition:transform .2s ease;box-shadow:-12px 0 38px rgba(15,23,42,.16);background:var(--ui-surface,#fff)}
  body.mortx-ui-shell .mortx-workspace.widgets-mobile-open .mortx-widgets-panel{transform:translateX(0)}
  body.mortx-ui-shell .mortx-workspace.widgets-mobile-open .mortx-widgets-backdrop{display:block}
  body.mortx-ui-shell .mortx-workspace.widgets-collapsed .mortx-widgets-panel{display:flex}
  body.mortx-ui-shell .mortx-workspace .mortx-widgets-panel[hidden]{display:flex!important}
  body.mortx-ui-shell .mortx-system-footer{right:0}
}

/* Working Hours: Bootstrap card, with existing IDs and event bindings preserved. */
body.mortx-ui-shell .mortx-working-hours-widget{
  margin:14px 0;min-width:0;
  border:1px solid var(--ui-border,rgba(128,145,170,.18));
  border-radius:10px;background:var(--bs-body-bg,#fff);
  box-shadow:0 1px 3px rgba(0,0,0,.035);
}
body.mortx-ui-shell .mortx-working-hours-widget-heading{margin:0;padding:12px 14px;border-bottom:1px solid var(--ui-border,rgba(128,145,170,.18))}
body.mortx-ui-shell .mortx-working-hours-widget .card-body{padding:14px}
body.mortx-ui-shell .mortx-working-hours-widget-heading h2{
  margin:0;font-size:13px;font-weight:700;line-height:1.4;
}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode{
  display:flex;flex-direction:column;gap:12px;min-width:0;
}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode-status{
  display:grid;grid-template-columns:8px minmax(0,1fr);align-items:center;
  column-gap:8px;row-gap:6px;padding:0;background:transparent;
  color:inherit;font-size:11px;font-weight:600;
}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode-dot{
  width:7px;height:7px;border-radius:50%;background:#94a3b8;
}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode-duration{
  grid-column:1 / -1;font-size:28px;font-weight:650;line-height:1.25;
  letter-spacing:-.035em;font-variant-numeric:tabular-nums;
}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode.is-working .header-work-mode-dot{background:#16a34a}
body.mortx-ui-shell .mortx-working-hours-widget .header-work-mode.is-paused .header-work-mode-dot{background:#d69e00}
body.mortx-ui-shell .mortx-working-hours-widget #workModeControls{
  grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:0;
}
body.mortx-ui-shell .mortx-working-hours-widget #workModeControls .work-mode-action{
  height:34px;font-size:11px;font-weight:650;gap:5px;
}
body.mortx-ui-shell .mortx-working-hours-widget #workModeControls .work-mode-action span{display:inline}
@media(max-width:1050px){
  body.mortx-ui-shell .mortx-working-hours-widget #workModeControls .work-mode-action{gap:3px;font-size:10px}
}

/* Header actions use the same flex row as the existing controls. */
body.mortx-ui-shell #appProjectBrandHeader .mortx-widgets-header-toggle{
  flex:0 0 42px;align-self:center;box-sizing:border-box;box-shadow:none;font-size:18px;
}
@media(max-width:1050px){
  body.mortx-ui-shell #appProjectBrandHeader .mortx-widgets-header-toggle{
    width:var(--mortx-tablet-control,42px);height:var(--mortx-tablet-control,42px);min-width:0;
  }
}
@media(max-width:760px){
  body.mortx-ui-shell #appProjectBrandHeader .mortx-widgets-header-toggle{
    width:var(--mortx-mobile-control,38px);height:var(--mortx-mobile-control,38px);
  }
}

/* Mobile widgets drawer shares the sidebar off-canvas interaction model. */
body.mortx-ui-shell .mortx-widgets-backdrop{display:none}
@media(max-width:760px){
 body.mortx-ui-shell .mortx-widgets-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:1399}
 body.mortx-ui-shell #appProjectBrandHeader .top-widget-group{display:grid!important;grid-template-columns:repeat(4,42px)!important;justify-content:end!important;gap:8px!important}
 body.mortx-ui-shell #appProjectBrandHeader .global-task-search{grid-column:1/-1;grid-row:2;width:100%!important;min-width:0!important}
 body.mortx-ui-shell #appProjectBrandHeader .top-row{align-items:start!important}
 body.mortx-ui-shell #appProjectBrandHeader .top-actions{width:100%!important}
 body.mortx-ui-shell #appProjectBrandHeader .top-widget-group{grid-template-columns:repeat(4,minmax(0,42px))!important;width:100%!important}
 body.mortx-ui-shell #appProjectBrandHeader .global-task-search{justify-self:stretch!important}
 body.mortx-ui-shell #appProjectBrandHeader .online-users-widget{grid-column:1;grid-row:1}
 body.mortx-ui-shell #appProjectBrandHeader .tag-notification-widget{grid-column:2;grid-row:1}
 body.mortx-ui-shell #appProjectBrandHeader #recurringWidget{grid-column:3;grid-row:1}
 body.mortx-ui-shell #appProjectBrandHeader .mortx-widgets-header-toggle{grid-column:4;grid-row:1}
}
