/* TG-DX-1111: unified desktop Studio layout. Preview ?tgdx=p1111. Off: features-live.json "dx":{"off":true}.
   Mobile (<1024px) is unchanged — all rules below are desktop-only. */

/* Hide the dx chrome until the desktop class is applied. */
#tees-studio .tgdx-rail,
#tees-studio .tgdx-side,
#tees-studio .tgdx-right,
#tees-studio .tgdx-dock{display:none}

@media (min-width:1024px){

/* ---------- shell grid: rail | side panel | canvas | right column ---------- */
#tees-studio.tgdx .ts-design{
  display:grid!important;
  grid-template-columns:72px minmax(0,1fr) 300px!important;
  grid-template-rows:minmax(0,1fr)!important;
  grid-template-areas:"rail stage right"!important;
  grid-auto-columns:0!important;
  grid-auto-rows:0!important;
  grid-auto-flow:row!important;
  position:relative!important;
  min-height:0!important;
  height:100%!important;
  overflow:hidden!important;
  background:#f4f4f5;
}
#tees-studio.tgdx.is-dx-panel .ts-design{
  grid-template-columns:72px 268px minmax(0,1fr) 300px!important;
  grid-template-areas:"rail side stage right"!important;
}
/* Leftover Studio nodes must not create implicit grid tracks before JS reparents them. */
#tees-studio.tgdx .ts-design > :not(.tgdx-rail):not(.tgdx-side):not(.ts-stage):not(.tgdx-right){
  position:absolute!important;
  left:-9999px!important;
  top:0!important;
  width:1px!important;
  height:1px!important;
  overflow:hidden!important;
  pointer-events:none!important;
}

#tees-studio.tgdx .tgdx-rail{
  display:flex!important;
  grid-area:rail;
  flex-direction:column;
  align-items:stretch;
  gap:2px;
  background:#fff;
  border-right:1px solid #ececec;
  padding:8px 4px 10px;
  z-index:8;
  min-height:0;
  overflow:auto;
}
#tees-studio.tgdx .tgdx-side{
  display:none!important;
  grid-area:side;
  min-width:0;
  min-height:0;
  background:#1d1d1f;
  color:#fff;
  overflow:auto;
  border-right:1px solid #111;
  z-index:8;
}
#tees-studio.tgdx.is-dx-panel .tgdx-side{display:flex!important;flex-direction:column}

#tees-studio.tgdx .ts-stage{
  grid-area:stage!important;
  position:relative!important;
  left:auto!important;top:auto!important;right:auto!important;bottom:auto!important;
  width:auto!important;height:auto!important;
  min-width:0!important;min-height:0!important;
  /* reserved chrome so toolbars, legend, dock, zoom, price never cover the product */
  padding:52px 56px 58px 14px!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  background:#ececee;
}
#tees-studio.tgdx.has-dx-bar2 .ts-stage{padding-top:92px!important}

#tees-studio.tgdx .tgdx-right{
  display:flex!important;
  grid-area:right;
  flex-direction:column;
  min-width:0;
  min-height:0;
  background:#fff;
  border-left:1px solid #ececec;
  z-index:8;
  overflow:hidden;
}

/* Existing right-column nodes that we have not yet wrapped still land in the right area
   if JS has not run; the wrapper is the source of truth after boot. */
#tees-studio.tgdx .ts-views,
#tees-studio.tgdx .tgdk-add,
#tees-studio.tgdx .tgf-live-rail{
  position:relative!important;
  left:auto!important;top:auto!important;right:auto!important;bottom:auto!important;
  width:auto!important;transform:none!important;
  box-sizing:border-box;
}

/* Hide the always-open edit tools from the right column — they open in the left side panel. */
#tees-studio.tgdx .ts-tools{display:none!important}
#tees-studio.tgdx.is-dx-panel[data-dx-panel="edit"] .tgdx-side .ts-tools,
#tees-studio.tgdx.is-dx-panel[data-dx-panel="options"] .tgdx-side .ts-tools{
  display:block!important;
  position:relative!important;
  left:auto!important;top:auto!important;right:auto!important;bottom:auto!important;
  width:auto!important;height:auto!important;max-height:none!important;
  overflow:visible!important;
  padding:10px 12px 16px!important;
  background:transparent!important;
  border:0!important;
  color:#fff;
}
#tees-studio.tgdx .ts-colors{display:none!important}
#tees-studio.tgdx.is-dx-panel[data-dx-panel="options"] .tgdx-side .ts-colors{
  display:flex!important;
  position:relative!important;
  left:auto!important;top:auto!important;flex-wrap:wrap;gap:8px;
  width:auto!important;height:auto!important;padding:8px 0!important;
  background:transparent!important;
}

/* ---------- left rail ---------- */
#tees-studio.tgdx .tgdx-rail button.tgdx-ri{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;width:100%;min-height:54px;padding:6px 1px 4px;border:0;border-radius:10px;
  background:transparent;color:#222;cursor:pointer;font:600 10px/1.15 inherit;font-family:inherit;
  white-space:normal;text-align:center;overflow:visible;box-sizing:border-box;word-break:normal;
}
#tees-studio.tgdx .tgdx-rail button.tgdx-ri:hover{background:#f3f3f3}
#tees-studio.tgdx .tgdx-rail button.tgdx-ri.is-on{background:#111;color:#fff}
#tees-studio.tgdx .tgdx-rail button.tgdx-ri svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#tees-studio.tgdx .tgdx-rail .tgdx-rail-foot{margin-top:auto;display:flex;flex-direction:column;gap:4px;padding-top:8px}
#tees-studio.tgdx .tgdx-rail .tgpa-btn{
  position:relative!important;left:auto!important;top:auto!important;
  width:100%;height:auto!important;min-height:44px;padding:6px 4px!important;
  border-radius:10px!important;font-size:10px!important;justify-content:center;
  box-shadow:none!important;white-space:normal;text-align:center;line-height:1.2;
}

/* ---------- side panel ---------- */
#tees-studio.tgdx .tgdx-side .tgdx-sh{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 12px 8px;flex:none;
}
#tees-studio.tgdx .tgdx-side .tgdx-sh b{font-size:14px;font-weight:700}
#tees-studio.tgdx .tgdx-side .tgdx-x{
  border:0;background:rgba(255,255,255,.12);color:#fff;width:26px;height:26px;
  border-radius:50%;font-size:16px;line-height:1;cursor:pointer;
}
#tees-studio.tgdx .tgdx-side .tgdx-sbody{flex:1;min-height:0;overflow:auto;padding:0 12px 16px}
#tees-studio.tgdx .tgdx-side .tgdx-note{color:#bbb;font-size:12.5px;line-height:1.4;margin:8px 0}
#tees-studio.tgdx .tgdx-layers{display:flex;flex-direction:column;gap:6px}
#tees-studio.tgdx .tgdx-li{
  display:flex;align-items:center;gap:8px;padding:8px;border-radius:10px;
  background:rgba(255,255,255,.08);border:0;color:#fff;text-align:left;cursor:pointer;width:100%;
  font:600 12.5px/1.2 inherit;font-family:inherit;
}
#tees-studio.tgdx .tgdx-li.is-on{background:#fff;color:#111}
#tees-studio.tgdx .tgdx-li img{width:36px;height:36px;object-fit:contain;background:#fff;border-radius:6px;flex:none}
#tees-studio.tgdx .tgdx-li .tgdx-tt{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}

/* Colour panel lives in the reserved column — never over the canvas */
#tees-studio.tgdx .tgdx-side .tgdk-cph{display:none}
#tees-studio.tgdx .tgdx-side .tgdk-cp,
#tees-studio.tgdx .tgdx-side .tgdk-cp.tgdk-cp{
  display:block!important;
  position:relative!important;
  left:auto!important;top:auto!important;right:auto!important;bottom:auto!important;
  width:auto!important;height:auto!important;
  max-height:none!important;
  box-shadow:none!important;border-radius:0!important;
  padding:0 0 16px!important;
  background:transparent!important;
  color:#fff;z-index:1;
}
#tees-studio.tgdx .ts-stage > .tgdk-cp{display:none!important} /* if dsk still injects it on the stage, hide the overlay copy once we have a side panel */
#tees-studio.tgdx.is-dx-panel[data-dx-panel="colour"] .ts-stage > .tgdk-cp{display:none!important}

/* Hide the floating colour FAB — colour is a rail item */
#tees-studio.tgdx .tgdk-cpb{display:none!important}

/* ---------- right column ---------- */
#tees-studio.tgdx .tgdx-right .tgdx-rsave{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:8px;padding:12px 14px 6px;flex:none;
}
#tees-studio.tgdx .tgdx-right .tgsv-btn{
  position:relative!important;left:auto!important;top:auto!important;
  margin-left:auto;height:36px;box-shadow:none;white-space:nowrap;flex:none;
  width:auto!important;display:inline-flex!important;
}
#tees-studio.tgdx .ts-stage > .tgsv-btn{display:none!important} /* after reparent; hide any leftover on the stage */
#tees-studio.tgdx .tgdx-addrow{
  display:grid;grid-template-columns:repeat(3,1fr);gap:8px;
  padding:4px 14px 8px;
}
#tees-studio.tgdx .tgdx-addrow .ts-pill,
#tees-studio.tgdx .tgdx-addrow button{
  display:flex;align-items:center;justify-content:center;gap:6px;
  height:40px;padding:0 8px;border:1px solid #ddd;border-radius:20px;
  background:#fff;font:600 13px/1 inherit;font-family:inherit;color:#111;cursor:pointer;
}
#tees-studio.tgdx .tgdx-addrow svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2}
#tees-studio.tgdx .tgdx-paste{
  padding:0 14px 8px;
}
#tees-studio.tgdx .tgdx-paste .ts-url,
#tees-studio.tgdx .tgdx-paste input[type=url],
#tees-studio.tgdx .tgdx-paste input[placeholder*="URL" i],
#tees-studio.tgdx .tgdx-paste input[placeholder*="url" i],
#tees-studio.tgdx .tgdx-paste .ts-field{
  width:100%;box-sizing:border-box;height:40px;border:1px solid #ddd;border-radius:20px;
  padding:0 14px;font:14px/1 inherit;font-family:inherit;background:#fff;
}
#tees-studio.tgdx .tgdx-phint{margin:0 14px 8px;text-align:center;font-size:12px;color:#888}
#tees-studio.tgdx .tgdx-right .ts-views{
  display:flex!important;flex-wrap:wrap;justify-content:flex-start!important;
  gap:6px;padding:10px 12px 8px!important;height:auto!important;
  border-top:1px solid #eee;flex:none;
}
#tees-studio.tgdx .tgdx-right .ts-views .ts-vw{padding:0 10px!important;height:30px!important}
#tees-studio.tgdx .tgdx-right .tgf-live-rail{
  flex:1 1 auto;min-height:160px;padding:0 12px 12px!important;
  height:auto!important;display:block!important;overflow:hidden;
}
#tees-studio.tgdx .tgdx-right .tgf-live-rail .tgf-live,
#tees-studio.tgdx .tgdx-right .tgf-live{
  width:100%!important;height:220px!important;max-height:100%;
}

/* dsk's own add-row: if it wasn't reparented, hide duplicates */
#tees-studio.tgdx .ts-design > .tgdk-add{display:none!important}
#tees-studio.tgdx .tgdx-right .tgdk-add{display:block;padding:0}
#tees-studio.tgdx .tgdx-right .tgdk-add .tgdk-addr:nth-child(2){display:none} /* Clipart/Shapes live in the left rail */
#tees-studio.tgdx .tgdx-right .tgdk-hint{display:none}

/* ---------- top chrome on the canvas (no overlap) ---------- */
#tees-studio.tgdx .tgdk-glob{
  display:flex;gap:6px;position:absolute;left:12px;top:10px;z-index:7;
  flex-wrap:wrap;max-width:calc(100% - 120px);
}
#tees-studio.tgdx .tgdk-glob button{
  display:flex;align-items:center;gap:6px;height:32px;padding:0 12px;
  border:1px solid #ddd;border-radius:16px;background:#fff;
  font:500 13px/1 inherit;font-family:inherit;color:#111;cursor:pointer;white-space:nowrap;
}
#tees-studio.tgdx .tgdk-glob button.is-on{background:#111;color:#fff;border-color:#111}
#tees-studio.tgdx .tgdk-glob button.is-dis{opacity:.45;cursor:not-allowed}
#tees-studio.tgdx .tgdk-glob svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2}
#tees-studio.tgdx .tgdk-bar{
  display:flex;align-items:center;gap:2px;
  position:absolute;left:12px;top:10px;z-index:8;
  transform:none!important;
  background:#1d1d1f;color:#fff;border-radius:12px;padding:4px 6px;
  box-shadow:0 4px 18px rgba(0,0,0,.25);
  max-width:calc(100% - 108px);
  flex-wrap:nowrap;overflow-x:auto;
}
#tees-studio.tgdx .tgdk-leg{
  display:flex!important;align-items:center;gap:6px;flex-wrap:nowrap;
  position:absolute;left:12px;top:48px;bottom:auto!important;right:auto!important;
  width:auto!important;height:auto!important;max-width:none;z-index:6;
  font-size:12px;color:#333;background:rgba(255,255,255,.92);
  padding:3px 8px;border-radius:8px;box-sizing:border-box;
}
#tees-studio.tgdx .tgdk-leg span{display:inline-block;width:16px;height:0;border-top:2px solid #e30613;margin-left:6px;flex:none}
#tees-studio.tgdx .tgdk-leg .tgdk-ls{border-top:2px dashed #1e88e5}
#tees-studio.tgdx .tgdk-leg .tgdk-lm{border-top:1px dotted #e30613}
#tees-studio.tgdx:not(.tgdk-gd) .tgdk-leg{display:none!important}
#tees-studio.tgdx.has-dx-bar2 .tgdk-bar{top:48px!important}
#tees-studio.tgdx.has-dx-bar2 .tgdk-leg{top:86px}
#tees-studio.tgdx .tgdk-size{
  display:block;position:absolute;left:12px;bottom:12px;z-index:6;
  font-size:12px;font-weight:600;color:#222;background:#fff;
  border:1px solid #ddd;padding:6px 10px;border-radius:8px;
}

/* Auto / undo / redo / zoom / 3D / on-model — parked in reserved padding */
#tees-studio.tgdx .ts-auto{
  top:10px!important;left:auto!important;right:52px!important;z-index:7;
}
#tees-studio.tgdx .ts-ur{
  top:10px!important;right:10px!important;left:auto!important;z-index:7;
}
#tees-studio.tgdx .ts-zm{
  right:10px!important;bottom:52px!important;left:auto!important;z-index:7;
}
#tees-studio.tgdx .tg3d-btn{
  right:10px!important;bottom:148px!important;left:auto!important;z-index:7;
}
#tees-studio.tgdx .tgzz-fabs{
  left:12px!important;bottom:48px!important;z-index:6;
  /* sits just above the size label; Options panel is the better home, but keep a compact entry */
}
#tees-studio.tgdx.is-dx-panel[data-dx-panel="options"] .tgzz-fabs{
  position:relative!important;left:auto!important;bottom:auto!important;
  margin:8px 0;flex-direction:row;gap:8px;
}
#tees-studio.tgdx .ts-stage .ts-steps,
#tees-studio.tgdx .ts-steps{
  position:absolute!important;right:60px!important;bottom:12px!important;
  top:auto!important;left:auto!important;transform:none!important;z-index:7;
}
#tees-studio.tgdx .ts-top .ts-steps{/* until reparented, hide so it cannot cover Add to cart */
  position:absolute!important;left:-9999px!important;right:auto!important;bottom:auto!important;
}

/* Shapes rail: inside the reserved right padding of the stage */
#tees-studio.tgdx .tgdk-rail{
  right:10px!important;top:50%!important;transform:translateY(-50%)!important;
  z-index:6;
}

/* Bottom tool dock */
#tees-studio.tgdx .tgdx-dock{
  display:flex!important;align-items:center;gap:2px;
  position:absolute;left:50%;bottom:10px;transform:translateX(-50%);
  z-index:7;background:#1d1d1f;color:#fff;border-radius:14px;padding:4px;
  box-shadow:0 4px 16px rgba(0,0,0,.25);
}
#tees-studio.tgdx .tgdx-dock button{
  width:36px;height:34px;border:0;border-radius:10px;background:none;color:#fff;
  cursor:pointer;display:flex;align-items:center;justify-content:center;
}
#tees-studio.tgdx .tgdx-dock button:hover,
#tees-studio.tgdx .tgdx-dock button.is-on{background:rgba(255,255,255,.16)}
#tees-studio.tgdx .tgdx-dock svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#tees-studio.tgdx .tgdx-dock .tgdx-dock-3d{margin-left:4px;width:auto;padding:0 8px;gap:4px;font:700 11px/1 inherit;font-family:inherit}
#tees-studio.tgdx .tgdx-dock .tgdx-sep{width:1px;height:18px;background:rgba(255,255,255,.2);margin:0 3px}

/* Paste-here pill stays on the canvas, above the dock */
#tees-studio.tgdx .tgdk-paste{top:auto!important;bottom:52px!important;left:50%!important;transform:translateX(-50%)!important}

/* AOP keeps its own top row — don't stack ours on top of it */
#tees-studio.tgdx.tg-aop .tg-aop-bar{
  position:absolute!important;left:0;top:0;z-index:7;
  max-width:calc(100% - 60px);background:transparent;
}
#tees-studio.tgdx.tg-aop .tgdk-glob{display:none!important}
#tees-studio.tgdx.tg-aop .tgdk-leg{display:none!important}
#tees-studio.tgdx.tg-aop .tgdk-size{display:none!important}

/* Print-area editor bar stays at the bottom of the stage, above the dock */
#tees-studio.tgdx .tgpa-bar{left:8px;right:60px;bottom:52px}

/* Surface-warp admin controls (sw) live inside the PA bar — leave them alone */

/* ---------- width tweaks: 1280 / 1366 / 1440 / 1920 ---------- */
@media (min-width:1024px) and (max-width:1365px){
  #tees-studio.tgdx .ts-design{grid-template-columns:68px minmax(0,1fr) 260px!important}
  #tees-studio.tgdx.is-dx-panel .ts-design{grid-template-columns:68px 240px minmax(0,1fr) 260px!important}
  #tees-studio.tgdx .tgdx-right .tgf-live-rail .tgf-live,
  #tees-studio.tgdx .tgdx-right .tgf-live{height:190px!important}
  #tees-studio.tgdx .tgdx-addrow .ts-pill span{font-size:12px}
}
@media (min-width:1440px){
  #tees-studio.tgdx .ts-design{grid-template-columns:64px minmax(0,1fr) 320px!important}
  #tees-studio.tgdx.is-dx-panel .ts-design{grid-template-columns:64px 280px minmax(0,1fr) 320px!important}
  #tees-studio.tgdx .tgdx-right .tgf-live-rail .tgf-live,
  #tees-studio.tgdx .tgdx-right .tgf-live{height:240px!important}
}
@media (min-width:1920px){
  #tees-studio.tgdx .ts-design{grid-template-columns:64px minmax(0,1fr) 340px!important}
  #tees-studio.tgdx.is-dx-panel .ts-design{grid-template-columns:64px 300px minmax(0,1fr) 340px!important}
  #tees-studio.tgdx .tgdx-right .tgf-live-rail .tgf-live,
  #tees-studio.tgdx .tgdx-right .tgf-live{height:280px!important}
}


} /* end min-width 1024 */

/* Scale the empty-area hint to fit a small saved print-area shape (do not change the area). */
#tees-studio .ts-pa{container-type:size}
#tees-studio .ts-pa .tgf-empty{
  gap:clamp(2px, 8cqmin, 8px);
  padding:clamp(2px, 8cqmin, 10px);
  overflow:hidden;
}
#tees-studio .ts-pa .tgf-empty .tgf-eico{
  width:clamp(16px, 20cqmin, 44px);
  height:clamp(16px, 20cqmin, 44px);
  border-radius:clamp(6px, 10cqmin, 14px);
  flex:none;
}
#tees-studio .ts-pa .tgf-empty .tgf-eico svg{
  width:clamp(12px, 14cqmin, 22px);
  height:clamp(12px, 14cqmin, 22px);
}
#tees-studio .ts-pa .tgf-empty > span:not(.tgf-eico){
  font-size:clamp(7px, 7.5cqmin, 13px);
  line-height:1.15;
  max-width:100%;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
@container (max-height: 120px), (max-width: 120px){
  #tees-studio .ts-pa .tgf-empty > span:not(.tgf-eico){display:none}
}
