:root{
  --p341-inspector:278px;
  --p341-topbar:64px;
}

/* Advanced tools live inside one Tools popover, never across the toolbar. */
.p34-pro-tools.p341-tools-section{
  display:grid!important;
  gap:4px!important;
  margin:0!important;
  padding:4px 0 0!important;
}
.p341-tools-divider{
  margin:7px 10px 3px;
  padding-top:9px;
  border-top:1px solid #eceff4;
  color:#98a2b3;
  font-size:10px;
  font-weight:800;
  letter-spacing:.1em;
}
.p34-pro-tools .p341-tool-entry{
  display:flex!important;
  align-items:center!important;
  gap:11px!important;
  width:100%!important;
  border:0!important;
  border-radius:10px!important;
  padding:10px!important;
  background:transparent!important;
  color:#243044!important;
  text-align:left!important;
}
.p34-pro-tools .p341-tool-entry:hover{background:#f6f3ff!important;color:#5c32d6!important}
.p341-tool-entry>span{display:grid;place-items:center;width:29px;height:29px;border-radius:8px;background:#f2efff;color:#6941c6;font-weight:850}
.p341-tool-entry>div{display:grid;gap:1px}.p341-tool-entry strong{font-size:12px}.p341-tool-entry small{font-size:10px;color:#7a8597;font-weight:550}
.p31-tools-popover{max-height:min(76vh,620px)!important;overflow:auto!important;min-width:310px!important}

/* Keep the top bar calm and guarantee that Download remains visible. */
.p31-topbar{grid-template-columns:minmax(240px,1fr) auto minmax(280px,1fr)!important;overflow:visible!important}
.p31-topbar-center{min-width:0!important;flex-wrap:nowrap!important}
.p31-topbar-actions{justify-self:end!important;white-space:nowrap!important}
.p31-file-block input{width:min(244px,22vw)!important}
.p33-canvas-size{max-width:150px;overflow:hidden;text-overflow:ellipsis}

/* Slightly wider layers inspector, while preserving a large centre workspace. */
.poster-workspace{grid-template-columns:var(--p33-rail) minmax(0,1fr) var(--p341-inspector)!important}
.poster-workspace.p32-left-open{grid-template-columns:calc(var(--p33-rail) + var(--p33-drawer)) minmax(0,1fr) var(--p341-inspector)!important}
.p30-right-panel{width:var(--p341-inspector)!important}
.p31-page-filmstrip{right:var(--p341-inspector)!important}
.poster-layers button,.poster-layers .poster-layer,.poster-layers [data-layer-id]{white-space:normal!important;line-height:1.25!important;padding:9px 10px!important}

/* Always fit the whole canvas; no clipping under the toolbar or filmstrip. */
.poster-stage-wrap{min-height:0!important;overflow:hidden!important}
.poster-canvas-frame{min-height:0!important;height:100%!important;overflow:auto!important;padding:28px 34px!important;align-content:center!important}
.poster-canvas-frame #posterCanvas{flex:none!important}
.p341-single-page .poster-workspace{height:calc(100vh - var(--p33-topbar))!important}
.p341-single-page .p31-page-filmstrip{display:none!important}
.p341-single-page .poster-stage-wrap{grid-template-rows:48px minmax(0,1fr) 56px!important}

/* One clear zoom system with explicit Fit / 50 / 100 choices. */
.p341-zoom-bar{gap:5px!important}
.p341-zoom-bar select{height:32px;border:0;background:#f7f8fb;border-radius:7px;padding:0 7px;color:#344054;font-size:11px;font-weight:750;outline:none}
.p341-zoom-bar strong{min-width:42px!important}

/* Compact filmstrip, never over the design. */
.p31-page-filmstrip{height:52px!important;padding-top:6px!important;padding-bottom:6px!important}
.p31-page-filmstrip .project-pages>*{height:36px!important;min-width:88px!important}
.p31-page-filmstrip #duplicateProjectPage{height:36px!important}

/* Template cards are readable and premium. */
.template-mini-grid button{background:#fff!important;border:1px solid #e4e8ef!important;box-shadow:0 2px 8px rgba(16,24,40,.05)!important;color:#1f2937!important;overflow:hidden!important}
.template-mini-grid button:hover{border-color:#bca9ff!important;box-shadow:0 8px 20px rgba(80,48,190,.12)!important;transform:translateY(-1px)}
.template-mini-grid button strong{display:block!important;padding:8px 8px 10px!important;color:#263044!important;font-size:11px!important;line-height:1.25!important;background:#fff!important}
.template-mini-grid .template-swatch{min-height:86px!important}

@media(max-width:1320px){
  :root{--p341-inspector:258px}
  .p31-topbar{grid-template-columns:minmax(210px,1fr) auto minmax(250px,1fr)!important}
  .p31-file-block input{width:min(210px,19vw)!important}
  .p31-topbar-actions .p31-compact-button{padding-inline:10px!important}
}
@media(max-width:1100px){
  .poster-workspace,.poster-workspace.p32-left-open{grid-template-columns:var(--p33-rail) minmax(0,1fr)!important}
  .p30-right-panel{width:300px!important}
  .p31-topbar{grid-template-columns:1fr auto!important}
  .p31-topbar-center{display:flex!important}
  .p31-topbar-actions{grid-column:2;grid-row:1}
  .p31-file-block input{width:190px!important}
}
@media(max-width:760px){
  .p31-topbar-center .p33-canvas-size{display:none!important}
  .p31-topbar-actions #p31Preview,.p31-topbar-actions #savePoster{display:none!important}
  .p31-topbar{grid-template-columns:minmax(0,1fr) auto!important;padding:0 8px!important}
  .p31-file-block input{width:min(170px,46vw)!important}
  .poster-canvas-frame{padding:18px!important}
}
