/* Outer page gutters are shared; cards, fields and document interiors keep their own spacing. */

.content-shell .panel-header,
.ui-workspace .content-shell .panel-footer,
.content-shell #main>.page-body,
.content-shell #main>.settings,
.content-shell #main>.memory-page,
.content-shell .workspace>.panel,
.content-shell .member-roster,
.content-shell .library-roster,
.content-shell #main>.library-manager{padding-inline:var(--page-gutter)}

/* Keep the directory cards at their existing width after adding the outer gutter. */
.content-shell :is(.member-workspace,.library-workspace){grid-template-columns:248px minmax(0,1fr)}
.content-shell #main>.library-manager>:is(.library-manager-head,.library-manager-actions,.helper){padding-inline:0}

/* Simple dialogs keep a stable title-to-content rhythm even when no description is present. */
#dialog:not(.ui-form-dialog):not(.skill-editor-window):not(:has(#rule-title)) #form-body>h2:first-child+.description{
 margin-top:var(--ui-dialog-title-description-gap);
 margin-bottom:var(--ui-dialog-section-gap);
}
#dialog:not(.ui-form-dialog):not(.skill-editor-window):not(:has(#rule-title)) #form-body>h2:first-child+:not(.description){
 margin-top:var(--ui-dialog-section-gap);
}

/* Simple dialogs own their gutter; framed windows put it on the header, body and footer. */
#dialog:not(.ui-form-dialog):not(.skill-editor-window):not(:has(#rule-title)),
#folder-dialog,
.member-removal-dialog{padding-inline:var(--ui-dialog-gutter)}
#dialog.skill-editor-window #form-body,
#dialog.skill-editor-window .actions,
#dialog:has(#rule-title) #form-body,
#dialog:has(#rule-title) .actions,
#discovery-dialog>.discovery-header,
#discovery-body,
#discovery-status,
#archive-preview-dialog>.archive-window-heading,
#archive-preview-body,
#archive-preview-dialog>footer,
.memory-dialog>form>header,
.memory-dialog .memory-body,
.memory-dialog>form>footer,
.knowledge-dialog>#tr-form>header,
.knowledge-dialog .tr-body,
.knowledge-dialog>#tr-form>footer,
.work-plan-dialog>form>header,
.work-plan-dialog .wp-body,
.work-plan-dialog>form>footer,
.organization-dialog>header,
.organization-dialog .organization-review-body,
.organization-dialog>footer,
.correction-dialog>form>header,
.correction-dialog .correction-body,
.correction-dialog>form>footer{padding-inline:var(--ui-dialog-gutter)}

/* Framed dialogs share one exact action-footer rhythm. */
.work-plan-dialog>form>footer,
.knowledge-dialog>#tr-form>footer,
.memory-dialog>form>footer,
.organization-dialog>footer,
.correction-dialog>form>footer,
#dialog.skill-editor-window .actions,
#dialog:has(#rule-title) .actions{
 box-sizing:border-box;
 height:auto;
 min-height:var(--ui-action-footer-height);
 padding-block:0;
 gap:var(--ui-action-gap);
 align-items:center;
 flex-wrap:nowrap;
}
.work-plan-dialog>form>footer>button,
.knowledge-dialog>#tr-form>footer>button,
.memory-dialog>form>footer>button,
.organization-dialog>footer>button,
.correction-dialog>form>footer>button,
#dialog.skill-editor-window .actions>button,
#dialog:has(#rule-title) .actions>button{
 box-sizing:border-box;
 height:var(--ui-action-control-height);
 min-height:var(--ui-action-control-height);
 padding-block:0;
}
.organization-dialog>footer>[role=status]{
 min-width:0;
 overflow:hidden;
 text-overflow:ellipsis;
 white-space:nowrap;
}

/* Corner grips fit inside the gutter without covering footer actions. */
#dialog.skill-editor-window .skill-window-resize,
#discovery-dialog .discovery-resize{right:1px;bottom:1px;width:22px;height:22px;padding:3px}
