/* Reusable workspace editors, section navigation and local pagination. */
.app-shell :is(button, .btn, .olk-button, input:not([type='checkbox']):not([type='radio']), select, textarea),
.olk-dialog :is(button, input:not([type='checkbox']):not([type='radio']), select, textarea) { font-size: 16px; }
.app-shell :is(button, .btn, .olk-button), .olk-editor-page :is(button, input:not([type='checkbox']):not([type='radio']), select), .olk-local-pager button, .olk-section-navigation button { min-height: 44px; }
[data-ui-inactive], [data-ui-page-hidden] { display: none !important; }
#main-content.has-page-editor { max-width: none; padding: 0; display: flex; flex: 1; min-height: 0; }
.olk-editor-page { width: 100%; min-width: 0; color: var(--olk-ink); background: var(--olk-canvas); }
.olk-editor-page > form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100dvh - var(--olk-workspace-top, 64px)); min-height: 360px; }
.olk-editor-page .modal-header { padding: 16px 24px; background: var(--olk-surface); gap: 16px; }
.olk-editor-page .modal-header h2 { font-size: 1.4rem; line-height: 1.25; }
.olk-editor-page .modal-header p { font-size: 1rem; line-height: 1.4; margin-top: 6px; }
.olk-editor-page .modal-body { min-height: 0; min-width: 0; overflow: auto; padding: 20px 24px; scroll-padding: 16px; }
.olk-editor-page .modal-footer { padding: 12px 24px; background: var(--olk-surface); flex-wrap: wrap; }
.olk-editor-page .modal-footer .btn { min-width: 130px; }
.olk-editor-page :is(.form-grid, .olk-form-grid) { gap: 16px; }
.olk-editor-page .field-label { font-size: 1rem; line-height: 1.4; }
.olk-editor-page .field-help { font-size: .875rem; line-height: 1.45; }
.olk-editor-page textarea { min-height: 96px; }
.olk-editor-page :is(.form-error, .form-section) { scroll-margin: 16px; }
.olk-section-navigation { position: sticky; top: -20px; z-index: 3; background: var(--olk-canvas); padding: 0 0 16px; margin-bottom: 4px; }
.olk-section-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.olk-section-tab { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; min-height: 46px; border: 1px solid var(--olk-border); border-radius: var(--olk-radius-md); font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.35; background: var(--olk-surface); color: var(--olk-muted); cursor: pointer; }
.olk-section-tab:hover { background: var(--olk-surface-hover); color: var(--olk-ink); }
.olk-section-tab[aria-selected='true'] { background: var(--olk-primary); color: var(--olk-on-primary); border-color: var(--olk-primary); }
.olk-section-tab:focus-visible { outline: 3px solid var(--olk-focus); outline-offset: 2px; }
.olk-section-steps { display: none; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.olk-section-progress { text-align: center; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
[data-ui-section] { min-width: 0; outline: none; }
.olk-local-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-top: 8px; border-top: 1px solid var(--olk-border); background: var(--olk-surface); position: sticky; bottom: 0; z-index: 2; }
.olk-local-pager[hidden], .olk-section-navigation[hidden], .olk-section-tab[hidden] { display: none; }
.olk-page-status { color: var(--olk-muted); font-size: 1rem; text-align: center; }
[data-ui-pages] > [data-ui-page] { margin-top: 0; }
[data-ui-choices], .olk-editor-page .check-list { min-width: 0; }
.olk-editor-page :is(.checkbox-label, .commerce-choice) { min-height: 44px; font-size: 1rem; }
@media (max-width: 900px) {
  .olk-section-tabs { display: none; }
  .olk-section-steps { display: grid; }
}
@media (max-width: 900px), (max-height: 760px) {
  .olk-editor-page > form { min-height: 320px; }
  .olk-editor-page .modal-header { padding: 12px 18px; }
  .olk-editor-page .modal-header p { margin-top: 4px; }
  .olk-editor-page .modal-body { padding: 16px 18px; }
  .olk-section-navigation { top: -16px; padding-bottom: 12px; }
  .olk-editor-page .modal-footer { padding: 10px 18px; }
}
@media (max-width: 540px) {
  .olk-editor-page > form { height: calc(100dvh - var(--olk-workspace-top, 64px)); min-height: 320px; }
  .olk-editor-page .modal-header h2 { font-size: 1.2rem; }
  .olk-editor-page .modal-header p { font-size: .9rem; }
  .olk-editor-page .modal-header, .olk-editor-page .modal-body, .olk-editor-page .modal-footer { padding-left: 12px; padding-right: 12px; }
  .olk-section-steps { gap: 8px; }
  .olk-section-steps .btn { padding-left: 12px; padding-right: 12px; }
  .olk-section-progress { font-size: .875rem; }
  .olk-local-pager { gap: 8px; padding-left: 8px; padding-right: 8px; }
  .olk-page-status { flex: 1; font-size: .875rem; }
  .olk-local-pager button { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .olk-editor-page *, .olk-local-pager * { scroll-behavior: auto !important; }
}

[data-ui-columns-active] { display: grid; gap: 16px; align-items: start; }
[data-ui-columns-active][data-ui-columns='3'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-ui-columns-active][data-ui-columns='2'] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 540px) {
  [data-ui-columns] > [data-ui-section] { min-width: 0; }
}

.olk-section-progress { width: 100%; min-width: 0; min-height: 44px; font-size: 1rem; padding: 8px; border: 1px solid var(--olk-input-border); border-radius: var(--olk-radius-md); background: var(--olk-surface); color: var(--olk-ink); }
.workspace:has(#main-content.has-page-editor) > .workspace-footer { display: none; }
