@import url("./card-window-controls.css");
/* Zone 05: one stable header for every module, page and desktop layout. */
:root{--workspace-header-height:56px;scrollbar-gutter:stable}
:root[data-layout-effective] body .app-shell>.topbar{
  display:grid;grid-template-columns:clamp(120px,15cqi,180px) minmax(0,1fr) clamp(36px,11cqi,124px) 72px;
  grid-template-areas:"crumb totals action controls";align-items:center;gap:8px;
  height:var(--workspace-header-height);min-height:var(--workspace-header-height);max-height:var(--workspace-header-height);
  padding:6px 12px;flex:0 0 var(--workspace-header-height);overflow:hidden;
}
:root[data-layout-effective] body .topbar .breadcrumb{grid-area:crumb;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;min-width:0;gap:0 6px;font-size:10px;line-height:1.35;white-space:nowrap;overflow:hidden}
:root[data-layout-effective] body .topbar .breadcrumb>span:not([data-icon]):not(.crumb-slash){grid-column:1;grid-row:1;font-size:9px;color:var(--muted)}
:root[data-layout-effective] body .topbar .breadcrumb>.crumb-slash{display:none}
:root[data-layout-effective] body .topbar .breadcrumb strong{grid-column:1;grid-row:2;font-size:11px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:root[data-layout-effective] body .topbar .stats{grid-area:totals;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));container:native-metrics / inline-size;gap:0;margin:0;min-width:0;max-height:44px;overflow:visible}
:root[data-layout-effective] body .topbar .stat-card{min-width:0;min-height:32px;padding:0 7px;gap:5px;border:0;border-left:1px solid var(--scheme-line,var(--border))}
:root[data-layout-effective] body .topbar .stat-card:first-child{border-left:0}
:root[data-layout-effective] body .topbar .stat-title{font-size:9px;line-height:1.2;white-space:nowrap}
:root[data-layout-effective] body .topbar .stat-value{font-size:17px;line-height:1.15;white-space:nowrap;flex-wrap:nowrap;margin-top:2px}
:root[data-layout-effective] body .topbar .stat-value small{font-size:9px;white-space:nowrap}
:root[data-layout-effective] body .topbar .stat-icon{display:grid;width:22px;min-width:22px;height:28px;flex-shrink:0}
:root[data-layout-effective] body .topbar .stat-icon svg{width:16px!important;height:16px!important}
:root[data-layout-effective] body .topbar #editModeToggle{grid-area:action;justify-self:stretch;width:100%;min-width:0;max-width:100%;height:32px;min-height:32px;max-height:32px;padding:4px 8px;font-size:10px;gap:5px;white-space:nowrap;overflow:hidden;flex-shrink:0;transform:none;transition:background-color .15s,color .15s}
:root[data-layout-effective] body .topbar #editModeToggle svg{width:14px;height:14px;flex-shrink:0}
:root[data-layout-effective] body .topbar .edit-mode-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:root[data-layout-effective] body .topbar-right{grid-area:controls;display:flex;flex-wrap:nowrap;justify-content:flex-end;align-items:center;gap:6px;min-width:0;width:72px}
:root[data-layout-effective] body .topbar .save-indicator{font-size:0;gap:0;flex-shrink:0}
:root[data-layout-effective] body .topbar .save-indicator i{width:6px;height:6px}
:root[data-layout-effective] body .topbar .help-top{width:24px;min-width:24px;height:26px;padding:4px;flex-shrink:0}
:root[data-layout-effective] body .topbar .sync-backup{width:24px;min-width:24px;height:26px;padding:3px;font-size:0;flex-shrink:0}
:root[data-layout-effective] body .topbar .sync-backup .backup-label{display:none}
:root[data-layout-effective] body .topbar .sync-backup svg{width:16px;height:16px}
@container planner (max-width:850px){
  :root[data-layout-effective] body .app-shell>.topbar{grid-template-columns:clamp(100px,20cqi,150px) minmax(0,1fr) 34px 72px;gap:6px;padding-inline:8px}
  :root[data-layout-effective] body .topbar .edit-mode-text{display:none}
  :root[data-layout-effective] body .topbar #editModeToggle{padding:4px}
}
@container planner (max-width:460px){
  :root[data-layout-effective] body .app-shell>.topbar{--workspace-header-height:76px}
  :root[data-layout-effective] body .app-shell>.topbar{grid-template-columns:minmax(0,1fr) 34px 72px;grid-template-rows:30px 28px;grid-template-areas:"crumb action controls" "totals totals totals";gap:4px 6px;padding:5px 8px}
  :root[data-layout-effective] body .topbar .stats{max-height:28px;grid-template-columns:repeat(4,minmax(0,1fr))}
  :root[data-layout-effective] body .topbar .stat-card{min-height:25px;padding-inline:5px;gap:4px}
  :root[data-layout-effective] body .topbar .stat-value{font-size:14px;margin-top:0}
  :root[data-layout-effective] body .topbar .stat-title{font-size:8px}
  :root[data-layout-effective] body .topbar .stat-icon{width:18px;min-width:18px;height:22px}
}
@media print{:root[data-layout-effective] body .app-shell>.topbar{display:none}}

/* Both summaries respond to the width left by navigation and the editing controls. */
@media screen and (min-width:641px) {
  :root[data-layout-effective]:not([data-planner-embed]) body:not(.workspace-active) #mobilePageToolbar {
    grid-template-columns:clamp(110px,13cqi,164px) minmax(0,min(56%,680px)) max-content max-content;
    justify-content:start;
  }
  :root[data-layout-effective] body:not(.workspace-active) #mobilePageToolbar .topbar-right {
    width:auto;
    justify-content:flex-start;
  }
}
:root[data-layout-effective] #mobilePageToolbar .stat-title {
  overflow:hidden;
  text-overflow:ellipsis;
}
@container native-metrics (max-width:610px) {
  #mobilePageToolbar .stat-card :is(.stat-title,.stat-value small) { display:none; }
  #mobilePageToolbar .stat-card .stat-value { font-size:15px; margin:0; }
  #mobilePageToolbar .stat-card { min-height:28px; padding-inline:6px; gap:5px; }
  #mobilePageToolbar .stat-card .stat-icon { width:19px; min-width:19px; height:24px; }
}
@container native-metrics (max-width:390px) {
  #mobilePageToolbar .stat-card { padding-inline:3px; gap:3px; }
  #mobilePageToolbar .stat-card .stat-value { font-size:13px; }
  #mobilePageToolbar .stat-card .stat-icon { width:15px; min-width:15px; height:20px; }
  #mobilePageToolbar .stat-card .stat-icon svg { width:13px!important; height:13px!important; }
}

/* Personnel uses the same header cards; its grid starts at the table toolbar. */
#personnelRoot>.person-page-title{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#personnelRoot .person-toolbar{align-items:center;justify-content:flex-start;gap:5px 10px}
#personnelRoot .person-toolbar .person-filters{margin-left:auto;min-width:0}
#personnelRoot .person-toolbar .person-actions{position:static;margin:0 0 0 auto;flex-wrap:wrap;justify-content:flex-end;gap:6px}
@media(max-width:560px){#personnelRoot .person-toolbar .person-actions{width:100%}#personnelRoot .person-toolbar .person-actions .button{font-size:10px;min-height:26px;padding:4px 8px}}

/* Keep the site navigation in place while a workspace supplies the content. */
body.workspace-active{display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}
body.workspace-active .app-shell{display:flex;flex:1;flex-direction:column;min-height:0}
body.workspace-active:not(.workspace-chrome-active) .app-shell > .topbar,
body.workspace-active .app-shell > :is(#mainContent,#syncPanel,.app-footer),
body.workspace-active > :is(#accountWaiting,#catalogMenu,#barMenu,#drawerOverlay,#modalOverlay,#personCellMenu,#toast,#toastyEffect){display:none!important}
body.account-only.workspace-active:not(.auth-locked) .app-shell{display:flex!important}
body.auth-locked > #accountWaiting{display:none!important}
body.account-only.workspace-active .common-nav{display:block!important}
body.account-only.workspace-active .module-switch:has(#ordersModule:not([hidden])){display:flex!important}
body.account-only.workspace-active .module-menus:has(#ordersNav:not([hidden])){display:block!important;min-height:0}
#workspaceSurface{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden;background:var(--scheme-bg,var(--bg))}
#workspaceSurface .workspace-frame{display:block;width:100%;height:100%;border:0;background:transparent}
#workspaceSurface .workspace-loading{position:absolute;inset:0;display:grid;place-content:center;margin:0;padding:20px;text-align:center;color:var(--muted);background:var(--scheme-bg,var(--bg))}
#workspaceSurface{
  container:workspace-board / inline-size;
  --board-panel-width:min(var(--board-panel-preferred,720px),calc(100% - 320px));
  --card-window-line:var(--ganza-app-line,var(--border));
  --card-window-panel:var(--ganza-app-panel,var(--panel));
  --card-window-hover:var(--ganza-app-raised,var(--panel-raised));
  --card-window-text:var(--ganza-app-text,var(--ink));
  --card-window-muted:var(--ganza-app-muted,var(--muted));
  --card-window-accent:var(--ganza-app-accent,var(--green));
}
#workspaceSurface > .order-panel[data-board-panel]{
  position:absolute;inset:0 0 0 auto;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;
  border:0;border-inline-start:1px solid var(--card-window-line);overflow:hidden;z-index:60;
  background:var(--ganza-app-bg,var(--bg));color:var(--card-window-text);box-shadow:none;
}
body:not(.workspace-card-host) #workspaceSurface > :is(.order-panel[data-board-panel],.order-panel-shelf){display:none}
body.workspace-card-host #workspaceSurface > .order-panel[data-board-panel][open]{display:grid;grid-template-rows:auto minmax(0,1fr)}
#workspaceSurface .order-panel-header{display:flex;align-items:center;gap:8px;padding:9px 14px;background:var(--card-window-panel);border-bottom:1px solid var(--card-window-line)}
#workspaceSurface .order-panel-header h2{flex:1;min-width:0;margin:0;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#workspaceSurface .order-panel-header .button{min-height:31px;padding:4px 9px;font-size:12px;text-decoration:none}
#workspaceSurface .order-panel-header:has(.order-panel-window-controls){padding-block:0;padding-inline-end:0}
#workspaceSurface .order-panel iframe{width:100%;height:100%;border:0}
#workspaceSurface :is(.card-panel-resize,.card-panel-fold,.card-panel-return){
  position:absolute;z-index:4;display:grid;place-items:center;box-sizing:border-box;
  width:26px;min-width:0;height:28px;min-height:0;margin:0;padding:0;
  border:1px solid var(--card-window-line);border-radius:6px 0 0 6px;
  background:var(--card-window-panel);color:var(--card-window-muted);cursor:pointer
}
#workspaceSurface :is(.card-panel-resize,.card-panel-fold,.card-panel-return) svg{
  width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round;pointer-events:none
}
#workspaceSurface :is(.card-panel-resize,.card-panel-fold,.card-panel-return):is(:hover,:focus-visible){color:var(--card-window-accent);border-color:currentColor}
#workspaceSurface :is(.card-panel-resize,.card-panel-fold){right:100%;border-right:0}
#workspaceSurface .card-panel-fold{top:6px}
#workspaceSurface .card-panel-resize{top:38px;cursor:ew-resize;touch-action:none}
#workspaceSurface .card-panel-return{right:0;top:6px;z-index:61}
#workspaceSurface .card-panel-return[hidden],body:not(.workspace-card-host) #workspaceSurface .card-panel-return{display:none}
@media(any-pointer:coarse){
  #workspaceSurface :is(.card-panel-fold,.card-panel-resize,.card-panel-return)::after{content:"";position:absolute;inset:-8px 0 -8px -18px}
  #workspaceSurface .card-panel-resize{top:52px}
}
#workspaceSurface .order-panel[data-window-mode="max"]>.card-panel-resize{display:none}
#workspaceSurface[data-card-panel-resizing]{cursor:col-resize;user-select:none}
#workspaceSurface[data-card-panel-resizing] iframe{pointer-events:none}
#workspaceSurface[data-card-panel-resizing]>.workspace-frame,#workspaceSurface[data-card-panel-resizing]>.order-panel-shelf{transition:none!important}
#workspaceSurface .card-panel-width-status{position:absolute;z-index:4;inset:56px 16px auto auto;max-width:min(380px,calc(100% - 32px));margin:0;padding:10px 12px;border:1px solid var(--card-window-line);border-radius:6px;background:var(--card-window-panel);color:var(--card-window-text);font-size:12px}
#workspaceSurface > .order-panel[data-board-panel][data-window-mode="max"]{border-inline-start:0;box-shadow:none}
body.workspace-card-host #workspaceSurface:has(> .order-panel[data-board-panel][data-window-mode="max"][open]:not([inert]):not([data-card-shell-closing])) > .workspace-frame{visibility:hidden}

body.workspace-card-host #workspaceSurface:has(> .order-panel-shelf:not([hidden])){
  display:grid;
  grid-template:minmax(0,1fr) auto / minmax(0,1fr);
}
body.workspace-card-host #workspaceSurface:has(> .order-panel-shelf:not([hidden])) >
  :is(.workspace-frame,.workspace-loading,.order-panel[data-board-panel]){
  grid-area:1 / 1 / 2 / 2;
}
#workspaceSurface > .order-panel-shelf{
  position:relative;
  z-index:1;
  grid-area:2 / 1;
  min-width:0;
  padding:5px 8px 7px;
  background:var(--card-window-panel);
  border-block-start:1px solid var(--card-window-line);
  color:var(--card-window-text);
}

@container workspace-board (min-width:540px){
  #workspaceSurface > .order-panel[data-board-panel]:not([data-window-mode="max"]){width:var(--board-panel-width)}
  body.workspace-card-host #workspaceSurface:has(> .order-panel[data-board-panel][open]:not([inert]):not([data-window-mode="max"]):not([data-card-shell-closing])) >
    :is(.workspace-frame,.order-panel-shelf){width:calc(100% - var(--board-panel-width))}
  body.workspace-card-host #workspaceSurface:has(> .order-panel-shelf:not([hidden])) >
    .order-panel[data-board-panel]:not([data-window-mode="max"]){grid-row-end:-1}
}
@container workspace-board (min-width:540px) and (max-width:1151.99px){
  #workspaceSurface > *{--board-panel-width:min(var(--board-panel-preferred,720px),calc(100% - 52px))}
}
@container workspace-board (min-width:540px){
  #workspaceSurface > .order-panel[data-window-mode="side"]{overflow:visible}
}
@container workspace-board (width < 540px){
  #workspaceSurface .card-panel-resize{display:none}
  #workspaceSurface .order-panel .card-panel-fold{left:4px;right:auto;border:1px solid var(--card-window-line);border-radius:5px}
  #workspaceSurface .order-panel .order-panel-header{padding-inline-start:40px}
  body.workspace-card-host #workspaceSurface:has(> .order-panel[open]:not([inert]):not([data-card-shell-closing]))>.workspace-frame{visibility:hidden}
}
#workspaceSurface .order-panel[data-window-mode="max"]>.card-panel-fold{left:4px;right:auto;border:1px solid var(--card-window-line);border-radius:5px}
#workspaceSurface .order-panel[data-window-mode="max"]>.order-panel-header{padding-inline-start:40px}
#workspaceSurface > .order-panel[data-board-panel]{transition:translate 300ms cubic-bezier(.22,1,.36,1)}
#workspaceSurface > .order-panel[inert]{translate:calc(100% + 44px) 0;pointer-events:none}
@media(prefers-reduced-motion:reduce){
  #workspaceSurface > .order-panel[data-board-panel]{transition:none}
}
@container workspace-board (max-width:420px){
  #workspaceSurface .order-panel-header{gap:4px;padding:6px 8px}
  #workspaceSurface .order-panel-header h2{font-size:12px}
  #workspaceSurface .order-panel-header .button{padding-inline:5px;font-size:11px}
}
@media(max-width:560px){body.workspace-active > .sidebar{flex-shrink:0}}
body.workspace-active #mainContent [data-rf-mark]::after{content:none!important}
