.app-shell .workspace-dialog {
  box-sizing: border-box; width: min(820px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--app-border);
  border-radius: 14px; background: #fff; color: var(--app-ink); overflow: auto;
  box-shadow: 0 20px 80px #08231c30;
}
.app-shell .workspace-dialog::backdrop { background: #071b1566; }
.app-shell .workspace-dialog > header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 2; margin: 0; padding: 16px 24px;
  background: inherit; border-bottom: 1px solid var(--app-border);
}
.app-shell .workspace-dialog > header h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.app-shell .workspace-dialog > header button { flex: none; width: 36px; height: 36px; padding: 0; font-size: 24px; background: transparent; color: inherit; border: 0; }
.app-shell .workspace-dialog-body { padding: 24px; min-width: 0; }
.app-shell .workspace-dialog-body > :is(.panel, .upload, .skill-detail) { margin: 0; padding: 0; border: 0; box-shadow: none; width: 100%; }
.app-shell .workspace-dialog-body > .upload > summary { display: none; }
.app-shell .workspace-dialog .panel { max-width: 100%; }
.app-shell .workspace-dialog #create-set-search { width: 100%; }
.app-shell .workspace-dialog-status { margin: 16px 0 0; color: var(--app-muted); font-size: 13px; }
.app-shell .workspace-dialog-status:empty { display: none; }
.app-shell .workspace-dialog-status.error { color: #a32c26; }
.app-shell .workspace-dialog :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { max-width: 100%; box-sizing: border-box; }
.app-shell .workspace-dialog .form-grid { min-width: 0; }
.app-shell .workspace-dialog-wide { width: min(1120px, calc(100vw - 32px)); }
.app-shell .workspace-dialog-wide > .workspace-dialog-body { padding: 0; }
.app-shell .workspace-dialog-frame { display: block; width: 100%; height: min(760px, calc(100dvh - 128px)); border: 0; }
html:has(dialog:modal) { overflow: hidden; scrollbar-gutter: stable; }
html[data-workspace-embedded] .app-sidebar { display: none !important; }
html[data-workspace-embedded] .app-shell .app-main { margin: 0; width: 100%; padding: 24px; }
html[data-workspace-embedded] #workspace-loading { left: 24px; }
html[data-theme="dark"] .app-shell .workspace-dialog { background: var(--night-surface); color: var(--app-ink); border-color: var(--app-border); }
html[data-theme="dark"] .app-shell .workspace-dialog-status.error { color: #ffaaaa; }
@media (max-width: 720px) {
  .app-shell .workspace-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .app-shell .workspace-dialog > header { padding: 12px 16px; }
  .app-shell .workspace-dialog-body { padding: 16px; }
  .app-shell .workspace-dialog > header button { width: 44px; height: 44px; }
  .app-shell .workspace-dialog-frame { height: calc(100dvh - 112px); }
  .app-shell .workspace-dialog .form-grid { grid-template-columns: minmax(0, 1fr); }
  html[data-workspace-embedded] .app-shell .app-main { padding: 16px; }
}

.app-shell .workspace-dialog-body > details > summary { display:none; }
.app-shell .workspace-dialog-drawer { width:min(960px,calc(100vw - 32px)); height:100dvh; max-height:100dvh; margin:0 0 0 auto; border-radius:14px 0 0 14px; }
.app-shell .workspace-dialog-drawer > .workspace-dialog-body { padding:16px; }
@media(max-width:720px) { .app-shell .workspace-dialog-drawer { width:100vw; border:0; border-radius:0; } }

/* Embedded editors temporarily use the full viewport for their native top
   layer. Transparent frame margins let its backdrop dim the actual shell. */
html[data-workspace-frame-modal], html[data-workspace-modal-viewport] { overflow:hidden; scrollbar-gutter:auto!important; }
iframe.workspace-modal-viewport-frame {
  position:fixed!important; inset:0!important; z-index:2147483000!important;
  width:100vw!important; height:100dvh!important; min-height:0!important;
  max-width:none!important; max-height:none!important; margin:0!important; border:0!important;
}
html[data-workspace-modal-viewport],
html[data-workspace-modal-viewport] body.app-shell { background:transparent!important; }
html[data-workspace-modal-viewport] .app-main {
  position:fixed!important; margin:0!important;
  left:var(--workspace-underlay-left)!important; top:var(--workspace-underlay-top)!important;
  width:var(--workspace-underlay-width)!important; height:var(--workspace-underlay-height)!important;
  max-width:none!important; min-height:0!important; overflow:hidden!important;
}
