/* The desktop pile fills grid column one in the existing 1/8 + 7/8 workspace. */
@media (min-width: 0px) {
  .studio-history-pile:has(> .ds-stack) {
    padding: 0;
    container-type: inline-size;
    overflow: hidden;
    background: #e8e8e6;
  }
  .ds-stack {
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto auto;
    align-items: stretch;
    overflow: hidden;
    background: linear-gradient(95deg,#e5e5e2,#eeeef0);
    padding: clamp(.6rem,1.8vh,1.125rem) min(10px,6cqw);
    gap: clamp(.4rem,1.35vh,.9rem);
    color: #242425;
  }
  .ds-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .3rem;
    padding: .15rem .1rem .65rem;
    border-bottom: 1px solid #c9c9c8;
    color: #444445;
    font-size: .8rem;
    font-weight: 590;
  }
  .ds-heading svg,.ds-open svg,.ds-mode svg,.ds-icon svg,.ds-find svg {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
  }
  .ds-count {
    font: 600 .75rem/1.25 Inter,Arial,sans-serif;
    font-variant-numeric: tabular-nums;
    color: #393939;
    margin-left: auto;
  }
  .ds-drawing {
    display: block;
    position: relative;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 5px;
    padding: 0;
    cursor: default;
  }
  .ds-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  .ds-caption {
    min-width: 0;
    display: grid;
    align-content: end;
    gap: .24rem;
    border-top: 1px solid #c9c9c8;
    padding: .7rem .12rem 0;
  }
  .ds-position {
    color: #565656;
    font: 500 .75rem/1.3 Inter,Arial,sans-serif;
    font-variant-numeric: tabular-nums;
  }
  .ds-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-weight: 610;
    font-size: .92rem;
    line-height: 1.24;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
  }
  .ds-open,.ds-mode,.ds-more,.ds-icon {
    min-width: 0;
    border: 1px solid #bfbfbe;
    border-radius: .45rem;
    background: #fafafa;
    color: #303031;
  }
  .ds-tools {display:grid;gap:.35rem;min-width:0;}
  .ds-open,.ds-mode {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .36rem;
    min-height: 2.5rem;
    padding: .45rem .25rem;
    font-size: .8rem;
    font-weight: 560;
    line-height: 1.25;
    touch-action: manipulation;
  }
  .ds-mode {background:transparent;border-color:transparent;min-height:2rem;}
  .ds-mode[aria-pressed=true] {color:#fff;background:#343434;border-color:#343434;}
  .ds-mode[hidden] {display:none;}
  .ds-open span,.ds-mode span,.ds-heading-label { overflow-wrap: anywhere; }
  .ds-drawing:focus-visible,.ds-open:focus-visible,.ds-mode:focus-visible,.ds-picker :focus-visible {
    outline: 2px solid #222;
    outline-offset: 2px;
  }
  .ds-drawing:focus-visible { outline-offset: -2px; }
  .ds-picker {
    box-sizing: border-box;
    width: min(32rem,calc(100vw - 3rem));
    max-height: min(81dvh,38rem);
    padding: 1.25rem;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #b8b8b7;
    border-radius: .9rem;
    color: #222;
    background: #fff;
    box-shadow: 0 24px 72px #0003;
  }
  .ds-picker::backdrop {background: rgb(24 24 24 / .24);backdrop-filter: blur(3px);}
  .ds-picker-head,.ds-find,.ds-result,.ds-icon {display:flex;align-items:center;}
  .ds-picker-head {justify-content:space-between;gap:1rem;margin:0 0 .75rem;}
  .ds-picker-head h2 {font-size:1.45rem;line-height:1.18;margin:0;font-weight:610;}
  .ds-icon {justify-content:center;min-width:2.5rem;min-height:2.5rem;}
  .ds-find {gap:.62rem;padding:0 .7rem;border:1px solid #b6b6b5;border-radius:.4rem;color:#555;}
  .ds-find:focus-within {outline:2px solid #343434;outline-offset:1px;}
  .ds-find input {
    min-width:0;width:100%;height:2.7rem;padding:0;background:transparent;
    border:0;color:#222;font-size:1rem;outline:0!important;
  }
  .ds-total {margin:.75rem 0 .4rem;color:#575757;font-size:.81rem;font-variant-numeric:tabular-nums;}
  .ds-list {margin:0;padding:0;display:grid;list-style:none;}
  .ds-list li + li {border-top:1px solid #e3e3e3;}
  .ds-result {
    gap:.7rem;width:100%;min-height:2.9rem;padding:.47rem .5rem;border:0;
    border-radius:.27rem;background:transparent;color:#333;text-align:left;font-size:.94rem;
  }
  .ds-result[aria-current=page] {font-weight:600;background:#efefee;}
  .ds-number {min-width:2.2em;color:#646464;font-variant-numeric:tabular-nums;font-size:.8rem;}
  .ds-result-name{min-width:0;overflow-wrap:anywhere;}
  .ds-result-name small {display:block;color:#555;font-size:.8rem;font-weight:450;}
  .ds-active {margin-left:auto;flex-shrink:0;color:#565656;font-size:.76rem;font-weight:510;}
  .ds-more {min-height:2.55rem;margin-top:.7rem;padding:.45rem .8rem;font-size:.9rem;}
  .ds-more[hidden] {display:none;}
  @container (max-width: 140px) {
    .ds-heading {gap:.3rem;}
    .ds-heading-label {font-size:.76rem;}
    .ds-title {font-size:.86rem;}
    .ds-open {display:grid;grid-auto-flow:column;gap:.25rem;font-size:.76rem;}
  }
  @container (max-width: 110px) {
    .ds-heading-label, .ds-open span, .ds-mode span {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
    .ds-open {display:flex;}
  }
  @media (max-height:420px) {
    .ds-stack {padding-block:.3rem;gap:.25rem;}
    .ds-caption {padding-top:.25rem;}
    .ds-title {-webkit-line-clamp:1;}
    .ds-open {min-height:1.8rem;}
  }
  @media (hover:hover) {
    .ds-open:hover,.ds-mode[aria-pressed=false]:hover,.ds-more:hover,.ds-icon:hover,.ds-result:hover {background:#e8e8e7;}
  }
  @media (forced-colors:active) {
    .ds-open,.ds-drawing,.ds-picker,.ds-result[aria-current=page] {border:1px solid CanvasText;}
    .ds-stack,.ds-picker {background:Canvas;color:CanvasText;}
    .ds-open:focus-visible,.ds-drawing:focus-visible,.ds-picker :focus-visible {outline-color:Highlight;}
  }
}

/* Public company windows retain the Studio's 1/8 pile and 7/8 reading surface. */
body:has(dialog.dbx-workspace[open]) { overflow: hidden; }
dialog.dbx-workspace {
  --dbx-win-navy: #132c46;
  --dbx-win-line: #d4dee5;
  --dbx-win-muted: #526474;
  box-sizing: border-box;
  width: min(78rem,calc(100vw - clamp(1rem,6vw,7rem)));
  height: min(55rem,calc(100dvh - clamp(1.2rem,10vh,8rem)));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid #b9c7d3;
  border-radius: 14px;
  background: #fff;
  color: var(--dbx-win-navy);
  box-shadow: 0 32px 110px #0e243e42;
  overflow: hidden;
}
dialog.dbx-workspace:not([open]),dialog.ds-picker:not([open]) { display:none; }
dialog.dbx-workspace::backdrop {
  background: rgba(15,36,59,.26);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.dbx-workspace *, .dbx-workspace *::after, .dbx-workspace *::before {box-sizing:border-box;}
.dbx-workspace-layout {display:grid;grid-template-columns:12.5% minmax(0,1fr);height:100%;min-height:0;}
.dbx-window-stage {
  --sheet-step-x:clamp(5px,.85vw,10px);
  --sheet-step-y:clamp(4px,.8vh,8px);
  position:relative;
  isolation:isolate;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background:linear-gradient(135deg,#d4dfe8,#eff3f6 60%);
}
.studio-active-window {
  position:absolute;
  inset:calc(var(--sheet-count-behind,0) * var(--sheet-step-y)) 0 0 calc(var(--sheet-count-behind,0) * var(--sheet-step-x));
  transform-origin:top left;
  transform:translate(calc(-1 * var(--sheet-depth,0) * var(--sheet-step-x)),calc(-1 * var(--sheet-depth,0) * var(--sheet-step-y))) scale(var(--sheet-scale,1));
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template: auto minmax(0,1fr) / minmax(0,1fr);
  overflow: hidden;
  background: white;
}
.dbx-window-stage:has(> [inert]) > .studio-active-window {
  border:1px solid #afbfce;
  border-radius:10px 0 0 0;
  box-shadow:-2px -2px 7px #19334c24;
}
.dbx-window-stage > [inert] {pointer-events:none;user-select:none;}
.dbx-window-stage > [inert]::after {
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  background:#244561;
  opacity:calc(.055 + var(--sheet-depth) * .035);
}
.studio-window-bar {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: clamp(.65rem,1.5vw,1.25rem);
  min-width: 0;
  padding: .7rem clamp(.9rem,2.4vw,1.8rem);
  border-bottom: 1px solid var(--dbx-win-line);
  background: white;
}
.studio-window-title {
  margin: 0;
  white-space: normal;
  min-width: 0;
  overflow-wrap: anywhere;
  font: 600 clamp(1rem,1.5vw,1.28rem)/1.2 Inter,Arial,sans-serif;
  letter-spacing: -.032em;
  color: var(--dbx-win-navy);
}
.studio-window-title:focus { outline: none; }
.dbx-window-identity {min-width:0;}
.dbx-window-subtitle {
  margin:.2rem 0 0;
  color:var(--dbx-win-muted);
  font:450 clamp(.72rem,.85vw,.82rem)/1.35 Inter,Arial,sans-serif;
  overflow-wrap:anywhere;
}
.dbx-workspace .dbx-window-control {min-width:44px;min-height:44px;}
.studio-window-body {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: clamp(1.25rem,3.5vw,3rem);
  scrollbar-width: thin;
  scrollbar-color: #b2c1cd transparent;
}
.studio-window-body > :first-child {margin-block-start:0;}
.studio-window-body > :last-child {margin-block-end:0;}
.dbx-window-actions {display:flex;align-items:center;gap:.4rem;}
.dbx-window-control, .dbx-mobile-pile, .dbx-workspace .ds-open, .dbx-workspace .ds-icon, .dbx-workspace .ds-more {
  font-family: inherit;
  cursor: pointer;
  color: white;
  background: var(--dbx-win-navy);
  border: 1px solid var(--dbx-win-navy);
  border-radius: 6px;
}
.dbx-window-control {
  min-width:44px;
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.4rem;
  padding:.55rem .8rem;
  font-size:.82rem;
  font-weight:570;
  line-height:1;
}
.dbx-window-close { color:var(--dbx-win-navy);background:white;border-color:var(--dbx-win-line); }
.dbx-control-icon {font:400 1.24rem/1 Arial,sans-serif;}
.dbx-mobile-pile {display:none;}
.studio-history-pile:has(> .ds-stack) { position:relative;min-width:0;border-right:1px solid var(--dbx-win-line);background:#eff3f6;color:var(--dbx-win-navy); }
.dbx-workspace .ds-stack { background:linear-gradient(100deg,#e9eff3,#f4f6f8);color:var(--dbx-win-navy); }
.dbx-workspace .ds-heading {color:#31485d;border-color:#c6d1da;}
.dbx-workspace .ds-caption {border-color:#c6d1da;}
.dbx-workspace .ds-position,.dbx-workspace .ds-count {color:var(--dbx-win-muted);}
.dbx-workspace .ds-mode {color:var(--dbx-win-navy);}
.dbx-workspace .ds-mode[aria-pressed=true] {color:white;background:var(--dbx-win-navy);}
.dbx-workspace .ds-picker {
  margin:auto;
  background:#fff;
  color:var(--dbx-win-navy);
  border-color:var(--dbx-win-line);
  z-index:1;
}
.dbx-workspace .ds-picker-head {position:static;background:transparent;padding:0;border:0;min-height:0;}
.dbx-workspace .ds-find svg, .dbx-workspace .ds-icon svg {width:1.05rem;height:1.05rem;flex-shrink:0;}
.dbx-workspace .ds-result[aria-current=page] {color:var(--dbx-win-navy);background:#edf2f6;}
.dbx-workspace .ds-more[hidden],.dbx-workspace .ds-mode[hidden] {display:none;}
.dbx-workspace button:focus-visible, .dbx-workspace a:focus-visible {outline:2px solid #477daa;outline-offset:2px;}
@media (hover:hover) {
  .dbx-workspace :is(.dbx-window-control,.ds-open,.ds-icon,.ds-more):hover {background:#214362;border-color:#214362;color:white;}
  .dbx-workspace .ds-result:hover {background:#f1f5f7;}
}
@media (prefers-reduced-motion:no-preference) {
  .dbx-window-stage > .studio-active-window {
    transition:transform 340ms cubic-bezier(.2,.72,.22,1),inset 340ms cubic-bezier(.2,.72,.22,1);
  }
  .dbx-window-stage > .dbx-sheet-enter {
    animation:dbx-sheet-open 350ms cubic-bezier(.17,.72,.22,1) backwards;
  }
  @keyframes dbx-sheet-open {
    from {transform:translate(clamp(2.4rem,10vw,7rem),clamp(.4rem,2vh,1rem));opacity:.35;}
    to {transform:translate(0,0) scale(1);opacity:1;}
  }
  dialog.dbx-workspace[open]::backdrop {animation:dbx-veil-in 290ms ease-out;}
  @keyframes dbx-veil-in {from {opacity:0;}}
}
@media (max-width:730px) {
  .dbx-window-stage {--sheet-step-x:3px;--sheet-step-y:5px;}
  dialog.dbx-workspace {width:calc(100% - .75rem);height:calc(100dvh - 1rem);border-radius:10px;}
  .studio-window-bar {padding:.38rem .6rem;gap:.45rem;}
  .studio-window-body {padding:1.05rem .9rem max(1.15rem,env(safe-area-inset-bottom));}
  .dbx-workspace .ds-stack {padding:0;gap:0;grid-template-rows:1fr;}
  .dbx-workspace .ds-heading,.dbx-workspace .ds-caption,.dbx-workspace .ds-tools,.dbx-workspace .ds-drawing {display:none;}
  .dbx-workspace .dbx-mobile-pile {
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    border:0;
    border-radius:0;
    writing-mode:vertical-rl;
    background:transparent;
    color:#213b51;
    font-size:.78rem;
    font-weight:600;
    letter-spacing:.01em;
  }
  .dbx-workspace .studio-history-pile::before {
    content:'';
    position:absolute;
    pointer-events:none;
    inset:8% 17% 8% 18%;
    background:repeating-linear-gradient(90deg,#d6e1e8 0 2px,transparent 2px 7px);
    opacity:.65;
  }
  .dbx-workspace .dbx-mobile-pile {background:linear-gradient(0deg,transparent 0 36%,#edf2f5 44% 56%,transparent 64%);}
  .dbx-workspace .ds-picker {width:min(32rem,calc(100vw - 1.5rem));max-height:80dvh;}
}
@media (max-width:450px) {
  .dbx-window-control {padding:.4rem;}
  .dbx-control-label {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);}
  .studio-window-title {font-size:1rem;}
}
@media (max-height:460px) {
  dialog.dbx-workspace {height:calc(100dvh - .6rem);}
  .studio-window-bar {padding-block:.15rem;}
}
@media(forced-colors:active) {
  .dbx-workspace, .studio-history-pile,.dbx-window-control {border:1px solid CanvasText;}
  .dbx-workspace button:focus-visible,.dbx-workspace a:focus-visible {outline-color:Highlight;}
}

@media (prefers-reduced-motion:reduce) {
  .dbx-workspace .studio-active-window, dialog.dbx-workspace[open]::backdrop {animation:none;transition:none;}
}
html[data-qx-motion="Reduced"] .dbx-window-stage > .studio-active-window, html[data-qx-motion="Reduced"] dialog.dbx-workspace[open]::backdrop {animation:none;transition:none;}
