/* Shared spacing and alignment for workspace controls. Resized docks keep their saved widths. */
body[data-pf-creative=true] {
  --pf-layout-gap:8px;
  --pf-layout-inset:12px;
  --pf-layout-control:32px;
  --pf-layout-heading:48px;
  --pf-layout-panel:280px;
}

body[data-pf-creative=true] [data-pf-account-button][data-signed-in=true] {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:var(--pf-layout-gap);
  line-height:1;
}
body[data-pf-creative=true] [data-pf-account-button] .pf-account-avatar:not([hidden]) {
  inline-size:22px;
  block-size:22px;
  margin:0;
}
body[data-pf-creative=true] [data-pf-account-button] .pf-account-avatar[hidden] {display:none!important}
body[data-pf-creative=true] [data-pf-account-button][data-signed-in=true] [data-account-name] {
  margin:0;
  line-height:1.25;
}

/* Field labels may wrap. Keep the input and its slider on the same baseline as its neighbour. */
body[data-pf-creative=true] #controls .pf-field-section > .grid {
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px var(--pf-layout-gap);
  align-items:stretch;
}
body[data-pf-creative=true] #controls .pf-field-section > .grid > label:not([hidden]) {
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
}
body[data-pf-creative=true] #controls .pf-field-section > .grid > label > :is(input[type=number],input[data-localized-number],select) {
  box-sizing:border-box;
  width:100%;
  min-width:0;
  margin:4px 0 0!important;
}
body[data-pf-creative=true] #controls .pf-field-section > .grid > label > input[type=range] {
  width:100%;
  margin:4px 0 0!important;
}

@media(min-width:921px) {
  body[data-pf-creative=true][data-pf-desktop=true][data-pf-desk-left=true] {
    --desk-left:var(--pf-custom-left,var(--pf-layout-panel));
  }
  body[data-pf-creative=true][data-pf-desktop=true][data-pf-desk-right=true] {
    --desk-right:var(--pf-custom-right,var(--pf-layout-panel));
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-layout[data-left=true] {
    --studio-left:var(--pf-custom-left,var(--pf-layout-panel));
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-layout[data-right=true] {
    --studio-right:var(--pf-custom-right,var(--pf-layout-panel));
  }
  body[data-pf-creative=true]:not(.presentation)>header {
    padding-inline:var(--pf-layout-inset)!important;
    column-gap:var(--pf-layout-gap)!important;
  }
  body[data-pf-creative=true]:not(.presentation)>header::after {
    inset-inline:var(--pf-layout-inset);
  }
  body[data-pf-creative=true]:not(.presentation)>header :is(#appFile>summary,#saveproject,#pfDeliveryMenu>summary,#pfDeckOpen,#pfCloudAccount) {
    box-sizing:border-box;
    height:var(--pf-layout-control)!important;
    min-height:var(--pf-layout-control)!important;
    margin:0!important;
    align-self:center;
  }
  body[data-pf-creative=true]:not(.presentation)>header #pfCloudAccount {
    width:auto;
    min-width:0!important;
    display:inline-flex!important;
    padding-inline:10px!important;
    gap:var(--pf-layout-gap)!important;
  }
  body[data-pf-creative=true]:not(.presentation)>header #outputActions {gap:var(--pf-layout-gap)!important}
  body[data-pf-creative=true]:not(.presentation)>header #pfModeSwitch {
    position:relative!important;
    align-items:center!important;
    justify-content:center;
  }
  body[data-pf-creative=true]:not(.presentation)>header #pfModeSwitch > :is(#pfModeDesign,#pfModeStudio) {
    height:var(--pf-layout-control)!important;
    min-height:var(--pf-layout-control)!important;
    width:96px;
    min-width:96px!important;
    box-sizing:border-box;
  }
  body[data-pf-creative=true]:not(.presentation)>header #pfModeSwitch #pfStudioView:not([hidden]) {
    position:absolute!important;
    top:50%!important;
    left:calc(100% + var(--pf-layout-gap))!important;
    transform:translateY(-50%)!important;
    box-sizing:border-box;
    height:var(--pf-layout-control)!important;
    min-height:var(--pf-layout-control)!important;
    width:174px!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:4px 8px!important;
    border:1px solid #657293!important;
    background:#142237!important;
    color:#ecf2fa!important;
    color-scheme:dark;
  }
  body[data-pf-creative=true]:not(.presentation) #appToolbar {
    padding-inline:var(--pf-layout-inset)!important;
    align-items:center!important;
    column-gap:var(--pf-layout-gap)!important;
  }
  body[data-pf-creative=true]:not(.presentation) #appToolbar>.polish-group {
    align-items:center!important;
    align-self:center;
  }

  body[data-pf-creative=true] :is(#pfDeskLeft,#pfDeskRight) .pf-desk-heading,
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-desk-heading {
    box-sizing:border-box;
    flex:0 0 var(--pf-layout-heading);
    height:var(--pf-layout-heading)!important;
    min-height:var(--pf-layout-heading)!important;
    padding:0 var(--pf-layout-inset)!important;
  }
  body[data-pf-creative=true][data-pf-desktop=true] #pfDesignProducts:not([hidden]) {
    box-sizing:border-box;
    flex:0 0 var(--pf-layout-heading);
    height:var(--pf-layout-heading);
    min-height:var(--pf-layout-heading);
    align-items:center;
    gap:var(--pf-layout-gap);
    padding:0 var(--pf-layout-inset)!important;
  }
  body[data-pf-creative=true][data-pf-desktop=true] #pfDesignProducts [data-products] {
    gap:var(--pf-layout-gap);
    align-items:center;
  }
  body[data-pf-creative=true][data-pf-desktop=true] #pfDesignProducts button {
    box-sizing:border-box;
    height:var(--pf-layout-control);
    min-height:var(--pf-layout-control);
  }
  body[data-pf-creative=true] :is(#pfDeskLeft,#pfDeskRight,#pfPBRDialog) :is(.pf-desk-scroll,.pf-pbr-scroll) {
    padding:var(--pf-layout-inset)!important;
    scrollbar-gutter:stable;
  }
  /* Allow the outer scrollbar to occupy the same gutter as the navigation inset. */
  body[data-pf-creative=true] :is(#pfDeskLeft,#pfDeskStudioLeft)>.pf-desk-scroll {
    padding-left:0!important;
  }
  body[data-pf-creative=true] :is(#pfDeskRight>.pf-desk-scroll,#pfPBRDialog[data-pf-workbench=true] .pf-pbr-controls>.pf-pbr-scroll) {
    padding-right:0!important;
  }
  body[data-pf-creative=true] #controls :is(#pfDeskLeft,#pfDeskRight) .pf-panel-jumps {
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-auto-rows:36px;
    gap:var(--pf-layout-gap)!important;
    align-content:start;
    padding:var(--pf-layout-gap) var(--pf-layout-inset)!important;
  }
  body[data-pf-creative=true] #controls .pf-panel-jumps>button:last-child:nth-child(odd) {
    grid-column:1/-1;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-panel-jumps {
    display:flex!important;
    flex-wrap:nowrap;
    gap:var(--pf-layout-gap)!important;
    align-items:stretch;
    padding:var(--pf-layout-gap) var(--pf-layout-inset)!important;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-panel-jumps>button {
    flex:1 1 0;
    height:44px;
    min-width:0;
    flex-direction:column;
    gap:3px;
    padding:4px!important;
    line-height:1.1;
    white-space:normal;
    text-align:center;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-panel-jumps>button {
    box-sizing:border-box;
    margin:0!important;
    min-width:0;
    justify-content:center;
    text-align:center;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-head {
    box-sizing:border-box;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto auto;
    align-items:center;
    gap:var(--pf-layout-gap);
    height:var(--pf-layout-heading);
    min-height:var(--pf-layout-heading);
    padding:0 var(--pf-layout-inset)!important;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-head>div:first-child {
    min-width:0;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] #pfDeskStudioTools {
    min-width:0;
    max-width:none;
    gap:var(--pf-layout-gap);
    padding:0;
    border:0;
    align-items:center;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-head :is(#pfDeskStudioTools>div,#pfStudioHistoryButtons) {
    align-items:center;
    gap:var(--pf-layout-gap);
    margin:0!important;
  }
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-head button {
    box-sizing:border-box;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    height:var(--pf-layout-control)!important;
    min-height:var(--pf-layout-control)!important;
    margin:0!important;
    padding:0 8px!important;
    line-height:1.2;
    font-size:11px;
  }
  body[data-pf-creative=true] #pfPBRDialog .pf-pbr-head .pf-studio-focus-action > span {
    border:0!important;
    padding:0!important;
    margin:0!important;
    background:none!important;
    box-shadow:none!important;
  }
}

@media(min-width:1200px) {
  body[data-pf-creative=true]:not(.presentation)>header #pfModeSwitch {
    position:absolute!important;
    grid-area:auto!important;
    top:25px!important;
    left:50%!important;
    transform:translate(-50%,-50%)!important;
  }
  /* Both sides start their content below the same navigation baseline. */
  body[data-pf-creative=true] #controls:has(.pf-panel-jumps>button:nth-child(3)) :is(#pfDeskLeft,#pfDeskRight) .pf-panel-jumps:not([hidden]) {
    min-height:97px;
    box-sizing:border-box;
  }
}

@media(max-width:920px) {
  body[data-pf-creative=true] :is(#pfPhoneNav,#pfMobileStudioNav) {
    grid-template-columns:none;
    grid-auto-flow:column;
    grid-auto-columns:minmax(0,1fr);
    align-items:stretch;
    gap:4px!important;
  }
  body[data-pf-creative=true] :is(#pfPhoneNav,#pfMobileStudioNav)>button {
    box-sizing:border-box;
    width:100%;
    min-width:0!important;
    min-height:48px!important;
  }
  body[data-pf-creative=true] #controls .pf-field-section > .grid > label > :is(input[type=number],input[data-localized-number],select) {
    min-height:44px!important;
  }
  body[data-pf-creative=true] #controls .pf-field-section>h3>button {
    padding-inline:8px!important;
  }
  body[data-pf-creative=true] :is(#pfPhoneHeading,#pfMobileStudioHead) {
    box-shadow:inset 0 -1px var(--pf-ui-line);
  }
}
body[data-pf-creative=true] #pfCloudAccount>.pf-account-avatar[hidden] {
  display:none!important;
}
body[data-pf-creative=true] #pfCloudAccount[data-signed-in=true]>.pf-account-avatar:not([hidden]) {
  display:inline-grid!important;
  inline-size:22px!important;
  block-size:22px!important;
  flex:0 0 22px;
  line-height:1;
}
@media(min-width:921px) {
  body[data-pf-creative=true] #pfDeskLeft #dpProductTools {margin-block:0 var(--pf-layout-gap)}
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] #pfDeskStudioLeft {margin-block:0!important}
  body[data-pf-creative=true] #pfPBRDialog[data-pf-workbench=true] .pf-pbr-head #pfPBRClose {justify-self:end}
}


@media(min-width:921px) and (max-width:1199px) {
  body[data-pf-creative=true][data-pf-compact=true] #pfDesignViewTools {
    box-sizing:border-box;
    flex:0 0 var(--pf-layout-heading);
    min-height:var(--pf-layout-heading)!important;
    padding-inline:var(--pf-layout-inset)!important;
    align-items:center;
  }
}
@media(max-width:920px) {
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-toolstrip {
    align-items:center;
    gap:4px;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-toolstrip .pf-mobile-subtools {
    padding:0;
    gap:4px;
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:minmax(0,1fr);
    touch-action:manipulation;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-subtools>button[hidden] {
    display:none!important;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-toolstrip :is(.pf-mobile-subtools button,.pf-mobile-all-tools) {
    box-sizing:border-box;
    height:44px;
    min-height:44px!important;
    margin:0!important;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-subtools>button:not([hidden]) {
    min-width:0!important;
    width:100%;
    padding:4px!important;
    font-size:11px!important;
    line-height:1.15;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  body[data-pf-creative=true] :is(#controls,#pfPBRDialog) .pf-mobile-toolstrip .pf-mobile-all-tools:not([hidden]) {
    width:64px;
    min-width:64px!important;
    padding:3px 5px!important;
    gap:3px;
    justify-content:center;
  }
}
